Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch canvas_image Excluding Merge-Ins
This is equivalent to a diff from 9d1db47d to 39bf9540
2018-03-04
| ||
21:45 | Merge branch tip-489 following acceptation of this TIP through TCT vote. check-in: afa7b579 user: fvogel tags: trunk | |
2018-02-21
| ||
20:58 | Fix error in testing argument numbers in 'canvas image' command. Thanks to René Zaumseil. Closed-Leaf check-in: 39bf9540 user: fvogel tags: canvas_image, tip-489 | |
2018-02-10
| ||
15:36 | Fix formatting in man canvas for the image command check-in: 1633e545 user: fvogel tags: canvas_image, tip-489 | |
2017-11-19
| ||
20:50 | Fix [73ba07efcd]: Use correct property type when handling MULTIPLE conversion requests. Patch from 'dpb' check-in: 23591c7d user: fvogel tags: core-8-6-branch | |
2017-11-14
| ||
07:05 | Don't include the NULL from SAVE_TARGETS request in the expected result. The ICCCM specification doesn't tell what value the clipboard manager should return. Closed-Leaf check-in: 9d1db47d user: fvogel tags: bug-73ba07efcd | |
2017-11-13
| ||
20:39 | Use -cleanup with test select-10.6 check-in: a087ba73 user: fvogel tags: bug-73ba07efcd | |
Changes to .fossil-settings/crlf-glob.
|
| < < | | < | 1 2 | win/*.bat win/*.vc |
Changes to .fossil-settings/crnl-glob.
|
| < < | | < | 1 2 | win/*.bat win/*.vc |
Changes to .fossil-settings/ignore-glob.
︙ | ︙ | |||
15 16 17 18 19 20 21 | */config.log */config.status */tkConfig.sh */wish* */tktest* */versions.vc doc/man.macros | | | > > > | 15 16 17 18 19 20 21 22 23 24 25 26 27 | */config.log */config.status */tkConfig.sh */wish* */tktest* */versions.vc doc/man.macros win/Debug* win/Release* win/nmhlp-out.txt win/nmakehlp.out unix/tk.pc html/* |
Changes to README.
1 | README: Tk | | | 1 2 3 4 5 6 7 8 9 | README: Tk This is the Tk 8.6.8 source distribution. http://sourceforge.net/projects/tcl/files/Tcl/ You can get any source release of Tk from the URL above. 1. Introduction --------------- This directory contains the sources and documentation for Tk, an X11 |
︙ | ︙ |
Changes to changes.
︙ | ︙ | |||
1311 1312 1313 1314 1315 1316 1317 | canvases) so that it correctly prints all of the characters in the ISO Latin-1 character set. 2/19/94 (bug fix) Modified tkBind.c to save and restore the interpreter's result across the execution of binding scripts. Otherwise if an event triggers in the middle of some other script (e.g. a destroy event during window creation, because there was an error in the creation command), | | | 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 | canvases) so that it correctly prints all of the characters in the ISO Latin-1 character set. 2/19/94 (bug fix) Modified tkBind.c to save and restore the interpreter's result across the execution of binding scripts. Otherwise if an event triggers in the middle of some other script (e.g. a destroy event during window creation, because there was an error in the creation command), the interpreter's result gets lost. 2/19/94 (bug fix) Fixed bug in dealing with results of sent command that could cause them to get lost in some situations. 2/21/94 (bug fix) Don't let user close a dialog window created by tk_dialog, since this would cause tk_dialog to hang: force the user to select one of the dialog's buttons. |
︙ | ︙ | |||
7366 7367 7368 7369 7370 7371 7372 | 2017-02-22 (bug)[c492c9] disabled combobox arrow appearance (danckaert) 2017-03-06 (bug)[6b3644] Fix -alpha for 16-bit color PNG (LemonMan) 2017-03-11 (bug)[775273] artifacts on Ubuntu 16.10+ (nemethi) | | | 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 | 2017-02-22 (bug)[c492c9] disabled combobox arrow appearance (danckaert) 2017-03-06 (bug)[6b3644] Fix -alpha for 16-bit color PNG (LemonMan) 2017-03-11 (bug)[775273] artifacts on Ubuntu 16.10+ (nemethi) 2017-03-26 (TIP 464) Win multimedia keys support (fassel,vogel) 2017-03-29 (bug)[28a3c3] test BTree memleaks plugged (anonymous) 2017-04-06 (bug)[db8c54] Stop freed mem access in warp pointer callback (porter) 2017-04-07 (bugs) Fix calculation of ttk::notebook tab widths (vogel) |
︙ | ︙ | |||
7411 7412 7413 7414 7415 7416 7417 | 2017-08-03 (bug)[9eab54] Fix -initialdir for OSX file dialogs (gollwitzer) 2017-08-08 (bug)[28d0b8] Follow ICCCM advice on X selection protocol (donchenko) 2017-08-08 (bug)[4966ca] Scidb race in notebook tab selection (cramer) --- Released 8.6.7, August 9, 2017 --- http://core.tcl.tk/tk/ for details | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 | 2017-08-03 (bug)[9eab54] Fix -initialdir for OSX file dialogs (gollwitzer) 2017-08-08 (bug)[28d0b8] Follow ICCCM advice on X selection protocol (donchenko) 2017-08-08 (bug)[4966ca] Scidb race in notebook tab selection (cramer) --- Released 8.6.7, August 9, 2017 --- http://core.tcl.tk/tk/ for details 2017-08-24 (bug)[f1a3ca] Memory leak in [text] B-tree (edhume3) 2017-08-24 (bug)[ee40fd] Report [console] init errors (the) 2017-08-24 (bug)[3295446] Improve history visibility in [console] (goth) 2017-08-24 (bug) canvas closed polylines fully honor -joinstyle (vogel) 2017-08-24 (bug)[cc42cc] out of mem crash in tests imgPhoto-18.* (vogel) 2017-09-16 (bug)[3406785] fix coords rounding when drawing canvas items (vogel) 2017-09-24 (bug)[8277e1] linux fontchooser sync with available fonts (vogel) 2017-09-24 (bug)[5239fd] Segfault copying a photo image to itself (bachmann) 2017-09-24 (bug)[514ff6] canvas rotated text overlap detection (vogel) 2017-09-24 (bug)[1e0db2] canvas rchars artifacts (bruchie,vogel) 2017-10-07 (bug)[d9fdfa] display of Long non-wrapped lines in text (cramer) 2017-10-07 (bug)[dd9667] text anchor not set (vogel) 2017-10-11 (bugs) memleaks and other changes for macOS 10.13 support (culler) 2017-10-11 (bug)[111de2] macOS colorspace improvement (walzer,culler) 2017-10-13 (bug) macOS scrolling issues (culler) 2017-10-15 (bug) clipping regions in scrolling and drawing on macOS (culler) 2017-10-15 (bug) macOS redraw artifacts (culler) 2017-10-22 (bug)[bb6b40] ::tk::AmpMenuArgs and 'entryconf' (vogel) 2017-10-22 (bug)[55b95f] Crash [scale] with a bignum value (vogel) 2017-10-28 (bug)[ce62c8] text-37.1 fails (vogel) 2017-11-03 (bug)[0ef1c5] OS X - tests menu-22.[345] hang (vogel) 2017-11-04 (bug)[c8c52b] repair OBOE in menu.test on macOS (vogel) 2017-11-11 (feature) Implement [wm_iconphoto] on macOS (walzer) 2017-11-11 (bug) display of embedded toplevels (culler) 2017-11-19 (bug)[73ba07] Correct property type for MULTIPLE conversion (dpb) 2017-11-20 (bug) Memory leak in tkImgPhoto.c. (werner) 2017-11-21 (bug) Defeat zombie toplevels (culler) 2017-11-25 (bug) macOS resposive menu bar for command line apps (culler) 2017-11-25 (bug)[1c659e] support png from mac screenshots (vogel) 2017-11-25 (bug)[de4af1] macOS file selector "all types" setting (culler) 2017-11-26 (bug) [wm withdraw] on Window and Dock menus (walzer) 2017-11-27 (feature) Drop support for macOS 10.5 (culler) 2017-11-30 (bug)[164c1b] Fixes [raise] on macOS (culler) 2017-11-30 (bug)[13d63d] macOS support of menu -postcommand (culler) 2017-12-05 (bug) enable custom icon display on macOS (walzer) 2017-12-05 (bug)[1088805,0feb63] macOS bind failures (culler) 2017-12-05 (bug)[3382424] Suppress noisy messages on macOS (culler) 2017-12-08 (new)[TIP 477] nmake build system reform (nadkarni) 2017-12-18 (bug)[b77626] Make [tk busy -cursor] silent no-op on macOS (vogel) --- Released 8.6.8, December 22, 2017 --- http://core.tcl.tk/tk/ for details |
Changes to doc/bind.n.
︙ | ︙ | |||
15 16 17 18 19 20 21 | .SH SYNOPSIS \fBbind\fI tag\fR ?\fIsequence\fR? ?\fB+\fR??\fIscript\fR? .BE .SH "INTRODUCTION" .PP The \fBbind\fR command associates Tcl scripts with X events. If all three arguments are specified, \fBbind\fR will | | > | | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | .SH SYNOPSIS \fBbind\fI tag\fR ?\fIsequence\fR? ?\fB+\fR??\fIscript\fR? .BE .SH "INTRODUCTION" .PP The \fBbind\fR command associates Tcl scripts with X events. If all three arguments are specified, \fBbind\fR will arrange for \fIscript\fR (a Tcl script called the .QW "binding script") to be evaluated whenever the event(s) given by \fIsequence\fR occur in the window(s) identified by \fItag\fR. If \fIscript\fR is prefixed with a .QW + , then it is appended to any existing binding for \fIsequence\fR; otherwise \fIscript\fR replaces any existing binding. If \fIscript\fR is an empty string then the current binding for \fIsequence\fR is destroyed, leaving \fIsequence\fR unbound. |
︙ | ︙ | |||
383 384 385 386 387 388 389 | to print out the keysym name for a particular key. If a keysym \fIdetail\fR is given, then the \fItype\fR field may be omitted; it will default to \fBKeyPress\fR. For example, \fB<Control\-comma>\fR is equivalent to \fB<Control\-KeyPress\-comma>\fR. .SH "BINDING SCRIPTS AND SUBSTITUTIONS" .PP | | > | 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | to print out the keysym name for a particular key. If a keysym \fIdetail\fR is given, then the \fItype\fR field may be omitted; it will default to \fBKeyPress\fR. For example, \fB<Control\-comma>\fR is equivalent to \fB<Control\-KeyPress\-comma>\fR. .SH "BINDING SCRIPTS AND SUBSTITUTIONS" .PP The \fIscript\fR argument to \fBbind\fR is a Tcl script, called the .QW "binding script", which will be executed whenever the given event sequence occurs. \fICommand\fR will be executed in the same interpreter that the \fBbind\fR command was executed in, and it will run at global level (only global variables will be accessible). If \fIscript\fR contains any \fB%\fR characters, then the script will not be executed directly. Instead, a new script will be |
︙ | ︙ | |||
602 603 604 605 606 607 608 | an \fBall\fR binding. The \fBbindtags\fR command may be used to change this order for a particular window or to associate additional binding tags with the window. .PP The \fBcontinue\fR and \fBbreak\fR commands may be used inside a binding script to control the processing of matching scripts. | | > > | | > > > > > > | 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 | an \fBall\fR binding. The \fBbindtags\fR command may be used to change this order for a particular window or to associate additional binding tags with the window. .PP The \fBcontinue\fR and \fBbreak\fR commands may be used inside a binding script to control the processing of matching scripts. If \fBcontinue\fR is invoked within a binding script, then this binding script, including all other .QW + appended scripts, is terminated but Tk will continue processing binding scripts associated with other \fItag\fR's. If the \fBbreak\fR command is invoked within a binding script, then that script terminates and no other scripts will be invoked for the event. .PP Within a script called from the binding script, \fBreturn\fR \fB-code ok\fR may be used to continue processing (including .QW + appended scripts), or \fBreturn\fR \fB-code break\fR may be used to stop processing all other binding scripts. .PP If more than one binding matches a particular event and they have the same \fItag\fR, then the most specific binding is chosen and its script is evaluated. The following tests are applied, in order, to determine which of several matching sequences is more specific: .RS |
︙ | ︙ |
Changes to doc/busy.n.
︙ | ︙ | |||
24 25 26 27 28 29 30 | '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH busy n "" Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME | | | | > | | 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 | '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH busy n "" Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME busy \- confine pointer events to a window sub-tree .SH SYNOPSIS \fBtk busy\fR \fIwindow \fR?\fIoptions\fR? .sp \fBtk busy hold\fR \fIwindow \fR?\fIoptions\fR? .sp \fBtk busy configure \fIwindow\fR ?\fIoption value\fR?... .sp \fBtk busy forget\fR \fIwindow \fR?\fIwindow \fR?... .sp \fBtk busy current\fR ?\fIpattern\fR? .sp \fBtk busy status \fIwindow\fR .BE .SH DESCRIPTION .PP The \fBtk busy\fR command provides a simple means to block pointer events from Tk widgets, while overriding the widget's cursor with a configurable busy cursor. Note this command does not prevent keyboard events from being sent to the widgets made busy. .SH INTRODUCTION .PP There are many times in applications where you want to temporarily restrict what actions the user can take. For example, an application could have a .QW Run button that when pressed causes some processing to occur. However, while the application is busy processing, you probably don't want the user to be |
︙ | ︙ | |||
64 65 66 67 68 69 70 | The \fBtk busy\fR command lets you make Tk widgets busy. This means that user interactions such as button clicks, moving the mouse, typing at the keyboard, etc.\0are ignored by the widget. You can set a special cursor (like a watch) that overrides the widget's normal cursor, providing feedback that the application (widget) is temporarily busy. .PP When a widget is made busy, the widget and all of its descendants will ignore | | | | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | The \fBtk busy\fR command lets you make Tk widgets busy. This means that user interactions such as button clicks, moving the mouse, typing at the keyboard, etc.\0are ignored by the widget. You can set a special cursor (like a watch) that overrides the widget's normal cursor, providing feedback that the application (widget) is temporarily busy. .PP When a widget is made busy, the widget and all of its descendants will ignore pointer events. It's easy to make an entire panel of widgets busy. You can simply make the toplevel widget (such as .QW . ) busy. This is easier and far much more efficient than recursively traversing the widget hierarchy, disabling each widget and re-configuring its cursor. .PP Often, the \fBtk busy\fR command can be used instead of Tk's \fBgrab\fR command. Unlike \fBgrab\fR which restricts all user interactions to one widget, with the \fBtk busy\fR command you can have more than one widget |
︙ | ︙ | |||
236 237 238 239 240 241 242 | .PP Mapping and unmapping busy windows generates Enter/Leave events for all widgets they cover. Please note this if you are tracking Enter/Leave events in widgets. .SS "KEYBOARD EVENTS" .PP When a widget is made busy, the widget is prevented from gaining the keyboard | | > | | > > > | | > > | > | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | .PP Mapping and unmapping busy windows generates Enter/Leave events for all widgets they cover. Please note this if you are tracking Enter/Leave events in widgets. .SS "KEYBOARD EVENTS" .PP When a widget is made busy, the widget is prevented from gaining the keyboard focus by a user clicking on it by the busy window. But if the widget already had focus, it still may receive keyboard events. The widget can also still receive focus through keyboard traversal. To prevent this, you must move focus to another window and make sure the focus can not go back to the widgets made busy (e.g. but restricting focus to a cancel button). .PP .CS pack [frame .frame] pack [text .frame.text] \fBtk busy\fR hold .frame pack [button .cancel -text "Cancel" -command exit] focus .cancel bind .cancel <Tab> {break} bind .cancel <Shift-Tab> {break} update .CE .PP The above example moves the focus from .frame immediately after invoking the \fBhold\fR so that no keyboard events will be sent to \fB.frame\fR or any of its descendants. It also makes sure it's not possible to leave button \fB.cancel\fR using the keyboard. .SH PORTABILITY .PP Note that the \fBtk busy\fR command does not currently have any effect on OSX when Tk is built using Aqua support. .SH "SEE ALSO" grab(n) .SH KEYWORDS busy, keyboard events, pointer events, window '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/canvas.n.
︙ | ︙ | |||
653 654 655 656 657 658 659 660 661 662 663 664 665 666 | See \fBINDICES\fR above for a description of the legal forms for \fIindex\fR. Note: the insertion cursor is only displayed in an item if that item currently has the keyboard focus (see the \fBfocus\fR widget command, above), but the cursor position may be set even when the item does not have the focus. This command returns an empty string. .TP \fIpathName \fBimove \fItagOrId index x y\fR .VS 8.6 This command causes the \fIindex\fR'th coordinate of each of the items indicated by \fItagOrId\fR to be relocated to the location (\fIx\fR,\fIy\fR). Each item interprets \fIindex\fR independently according to the rules described in \fBINDICES\fR above. Out of the standard set of items, only line | > > > > > > > > > > > > > > | 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 | See \fBINDICES\fR above for a description of the legal forms for \fIindex\fR. Note: the insertion cursor is only displayed in an item if that item currently has the keyboard focus (see the \fBfocus\fR widget command, above), but the cursor position may be set even when the item does not have the focus. This command returns an empty string. .TP \fIpathName \fBimage \fIimagename\fR ?\fIsubsample\fR? ?\fIzoom\fR? . Draw the canvas into the Tk photo image named \fIimagename\fR. If a \fB-scrollregion\fR has been defined then this will be the boundaries of the canvas region drawn and the final size of the photo image. Otherwise the widget width and height with an origin of 0,0 will be the size of the canvas region drawn and the final size of the photo image. Optionally an integer \fIsubsample\fR factor may be given and the photo image will be reduced in size. In addition to the \fIsubsample\fR an integer \fIzoom\fR factor can also be given and the photo image will be enlarged. The image background will be filled with the canvas background colour. The canvas widget does not need to be mapped for this widget command to work, but at least one of it's ancestors must be mapped. This command returns an empty string. .TP \fIpathName \fBimove \fItagOrId index x y\fR .VS 8.6 This command causes the \fIindex\fR'th coordinate of each of the items indicated by \fItagOrId\fR to be relocated to the location (\fIx\fR,\fIy\fR). Each item interprets \fIindex\fR independently according to the rules described in \fBINDICES\fR above. Out of the standard set of items, only line |
︙ | ︙ |
Changes to doc/grid.n.
︙ | ︙ | |||
156 157 158 159 160 161 162 | This space is added outside the slave(s) border. .TP \fB\-row \fIn\fR . Insert the slave so that it occupies the \fIn\fRth row in the grid. Row numbers start with 0. If this option is not supplied, then the slave is arranged on the same row as the previous slave specified on this | > | | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | This space is added outside the slave(s) border. .TP \fB\-row \fIn\fR . Insert the slave so that it occupies the \fIn\fRth row in the grid. Row numbers start with 0. If this option is not supplied, then the slave is arranged on the same row as the previous slave specified on this call to \fBgrid\fR, or the next row after the highest occupied row if this is the first slave. .TP \fB\-rowspan \fIn\fR . Insert the slave so that it occupies \fIn\fR rows in the grid. The default is one row. If the next \fBgrid\fR command contains \fB^\fR characters instead of \fIslaves\fR that line up with the columns of this \fIslave\fR, then the \fBrowspan\fR of this \fIslave\fR is |
︙ | ︙ |
Changes to doc/radiobutton.n.
︙ | ︙ | |||
37 38 39 40 41 42 43 | If this option is not specified, the button's desired height is computed from the size of the image or bitmap or text being displayed in it. .OP \-indicatoron indicatorOn IndicatorOn Specifies whether or not the indicator should be drawn. Must be a proper boolean value. If false, the \fB\-relief\fR option is ignored and the widget's relief is always sunken if the widget is selected and raised otherwise. | < < < < < < < < < < > > > > > > > > > > | 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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | If this option is not specified, the button's desired height is computed from the size of the image or bitmap or text being displayed in it. .OP \-indicatoron indicatorOn IndicatorOn Specifies whether or not the indicator should be drawn. Must be a proper boolean value. If false, the \fB\-relief\fR option is ignored and the widget's relief is always sunken if the widget is selected and raised otherwise. .OP \-offrelief offRelief OffRelief Specifies the relief for the checkbutton when the indicator is not drawn and the checkbutton is off. The default value is .QW raised . By setting this option to .QW flat and setting \fB\-indicatoron\fR to false and \fB\-overrelief\fR to .QW raised , the effect is achieved of having a flat button that raises on mouse-over and which is depressed when activated. This is the behavior typically exhibited by the Align-Left, Align-Right, and Center radiobuttons on the toolbar of a word-processor, for example. .OP \-overrelief overRelief OverRelief Specifies an alternative relief for the radiobutton, to be used when the mouse cursor is over the widget. This option can be used to make toolbar buttons, by configuring \fB\-relief flat \-overrelief raised\fR. If the value of this option is the empty string, then no alternative relief is used when the mouse cursor is over the radiobutton. The empty string is the default value. .OP \-selectcolor selectColor Background Specifies a background color to use when the button is selected. If \fB\-indicatoron\fR is true then the color applies to the indicator. Under Windows, this color is used as the background for the indicator regardless of the select state. If \fB\-indicatoron\fR is false, this color is used as the background for the entire widget, in place of \fB\-background\fR or \fB\-activeBackground\fR, whenever the widget is selected. If specified as an empty string then no special color is used for displaying when the widget is selected. .OP \-selectimage selectImage SelectImage Specifies an image to display (in place of the \fB\-image\fR option) when the radiobutton is selected. This option is ignored unless the \fB\-image\fR option has been specified. .OP \-state state State Specifies one of three states for the radiobutton: \fBnormal\fR, \fBactive\fR, |
︙ | ︙ |
Changes to doc/raise.n.
︙ | ︙ | |||
27 28 29 30 31 32 33 34 35 36 37 38 39 40 | \fIwindow\fR into the stacking order just above \fIaboveThis\fR (or the ancestor of \fIaboveThis\fR that is a sibling of \fIwindow\fR); this could end up either raising or lowering \fIwindow\fR. .PP All \fBtoplevel\fR windows may be restacked with respect to each other, whatever their relative path names, but the window manager is not obligated to strictly honor requests to restack. .SH EXAMPLE .PP Make a button appear to be in a sibling frame that was created after it. This is is often necessary when building GUIs in the style where you create your activity widgets first before laying them out on the display: .CS | > > > | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | \fIwindow\fR into the stacking order just above \fIaboveThis\fR (or the ancestor of \fIaboveThis\fR that is a sibling of \fIwindow\fR); this could end up either raising or lowering \fIwindow\fR. .PP All \fBtoplevel\fR windows may be restacked with respect to each other, whatever their relative path names, but the window manager is not obligated to strictly honor requests to restack. .PP On macOS raising an iconified \fBtoplevel\fR window causes it to be deiconified. .SH EXAMPLE .PP Make a button appear to be in a sibling frame that was created after it. This is is often necessary when building GUIs in the style where you create your activity widgets first before laying them out on the display: .CS |
︙ | ︙ |
Changes to doc/scale.n.
︙ | ︙ | |||
87 88 89 90 91 92 93 | .OP \-variable variable Variable Specifies the name of a global variable to link to the scale. Whenever the value of the variable changes, the scale will update to reflect this value. Whenever the scale is manipulated interactively, the variable will be modified to reflect the scale's new value. .OP \-width width Width | | | | | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | .OP \-variable variable Variable Specifies the name of a global variable to link to the scale. Whenever the value of the variable changes, the scale will update to reflect this value. Whenever the scale is manipulated interactively, the variable will be modified to reflect the scale's new value. .OP \-width width Width Specifies the desired narrow dimension of the scale in screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR). For vertical scales this is the scale's width; for horizontal scales this is the scale's height. .BE .SH DESCRIPTION .PP The \fBscale\fR command creates a new window (given by the \fIpathName\fR argument) and makes it into a scale widget. Additional options, described above, may be specified on the command line |
︙ | ︙ |
Changes to doc/selection.n.
︙ | ︙ | |||
136 137 138 139 140 141 142 143 144 145 146 147 148 149 | the new owner of \fIselection\fR on \fIwindow\fR's display, returning an empty string as result. The existing owner, if any, is notified that it has lost the selection. If \fIcommand\fR is specified, it is a Tcl script to execute when some other window claims ownership of the selection away from \fIwindow\fR. \fISelection\fR defaults to PRIMARY. .RE .SH EXAMPLES .PP On X11 platforms, one of the standard selections available is the \fBSECONDARY\fR selection. Hardly anything uses it, but here is how to read it using Tk: .PP .CS | > > > > > > > > > > > > > > > > > > > > | 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 | the new owner of \fIselection\fR on \fIwindow\fR's display, returning an empty string as result. The existing owner, if any, is notified that it has lost the selection. If \fIcommand\fR is specified, it is a Tcl script to execute when some other window claims ownership of the selection away from \fIwindow\fR. \fISelection\fR defaults to PRIMARY. .RE .SH WIDGET FACILITIES .PP The \fBtext\fR, \fBentry\fR, \fBttk::entry\fR, \fBlistbox\fR, \fBspinbox\fR and \fBttk::spinbox\fR widgets have the option \fB\-exportselection\fR. If a widget has this option set to boolean \fBtrue\fR, then (in an unsafe interpreter) a selection made in the widget is automatically written to the \fBPRIMARY\fR selection. .PP A GUI event, for example \fB<<PasteSelection>>\fR, can copy the \fBPRIMARY\fR selection to certain widgets. This copy is implemented by a widget binding to the event. The binding script makes appropriate calls to the \fBselection\fR command. .PP .SH PORTABILITY ISSUES .PP On X11, the \fBPRIMARY\fR selection is a system-wide feature of the X server, allowing communication between different processes that are X11 clients. .PP On Windows, the \fBPRIMARY\fR selection is not provided by the system, but only by Tk, and so it is shared only between windows of a master interpreter and its unsafe slave interpreters. It is not shared between interpreters in different processes or different threads. Each master interpreter has a separate \fBPRIMARY\fR selection that is shared only with its unsafe slaves. .PP .SH SECURITY .PP A safe interpreter cannot read from the \fBPRIMARY\fR selection because its \fBselection\fR command is hidden. For this reason the \fBPRIMARY\fR selection cannot be written to the Tk widgets of a safe interpreter. .PP A Tk widget can have its option \fB\-exportselection\fR set to boolean \fBtrue\fR, but in a safe interpreter this option has no effect: writing from the widget to the \fBPRIMARY\fR selection is disabled. .PP These are security features. A safe interpreter may run untrusted code, and it is a security risk if this untrusted code can read or write the \fBPRIMARY\fR selection used by other interpreters. .PP .SH EXAMPLES .PP On X11 platforms, one of the standard selections available is the \fBSECONDARY\fR selection. Hardly anything uses it, but here is how to read it using Tk: .PP .CS |
︙ | ︙ |
Changes to doc/text.n.
︙ | ︙ | |||
533 534 535 536 537 538 539 | option is only used when wrapping is enabled. If a text line wraps, the right margin for each line on the display is determined by the first non-elided character of that display line. .TP \fB\-rmargincolor \fIcolor\fR . \fIColor\fR specifies the background color to use in regions that do not | | | 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 | option is only used when wrapping is enabled. If a text line wraps, the right margin for each line on the display is determined by the first non-elided character of that display line. .TP \fB\-rmargincolor \fIcolor\fR . \fIColor\fR specifies the background color to use in regions that do not contain characters because they are indented by \fB\-rmargin\fR. It may have any of the forms accepted by \fBTk_GetColor\fR. If \fIcolor\fR has not been specified, or if it is specified as an empty string, then the color used is specified by the \fB-background\fR tag option (or, if this is also unspecified, by the \fB-background\fR widget option). .TP \fB\-selectbackground \fIcolor\fR \fIColor\fR specifies the background color to use when displaying selected |
︙ | ︙ |
Changes to doc/ttk_button.n.
︙ | ︙ | |||
35 36 37 38 39 40 41 | \fBdisabled\fR means that it is not defaultable. The default is \fBnormal\fR. .RS .PP Depending on the theme, the default button may be displayed with an extra highlight ring, or with a different border color. .RE | < < < < < < < < < < < < < < | 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 66 | \fBdisabled\fR means that it is not defaultable. The default is \fBnormal\fR. .RS .PP Depending on the theme, the default button may be displayed with an extra highlight ring, or with a different border color. .RE .\" Not documented -- may go away .\" .OP \-padding padding Padding .\" .OP \-foreground foreground Foreground .\" .OP \-font font Font .\" .OP \-anchor anchor Anchor .\" .OP \-relief relief Relief .SH "WIDGET COMMAND" .PP In addition to the standard \fBcget\fR, \fBconfigure\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR commands, buttons support the following additional widget commands: .TP \fIpathName \fBinvoke\fR Invokes the command associated with the button. .SH "STANDARD STYLES" .PP \fBTtk::button\fR widgets support the \fBToolbutton\fR style in all standard themes, which is useful for creating widgets for toolbars. .SH "SEE ALSO" ttk::widget(n), button(n) .SH "KEYWORDS" widget, button, default, command '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/ttk_label.n.
︙ | ︙ | |||
15 16 17 18 19 20 21 | .SH DESCRIPTION .PP A \fBttk::label\fR widget displays a textual label and/or image. The label may be linked to a Tcl variable to automatically change the displayed text. .SO ttk_widget \-class \-compound \-cursor | | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | .SH DESCRIPTION .PP A \fBttk::label\fR widget displays a textual label and/or image. The label may be linked to a Tcl variable to automatically change the displayed text. .SO ttk_widget \-class \-compound \-cursor \-image \-padding \-state \-style \-takefocus \-text \-textvariable \-underline \-width .SE .SH "WIDGET-SPECIFIC OPTIONS" .OP \-anchor anchor Anchor Specifies how the information in the widget is positioned relative to the inner margins. Legal values are |
︙ | ︙ |
Changes to doc/ttk_panedwindow.n.
︙ | ︙ | |||
102 103 104 105 106 107 108 109 110 111 112 113 114 115 | Sash positions are further constrained to be between 0 and the total size of the widget. .\" Full story: "total size" is either the -height (resp -width), .\" or the actual window height (resp actual window width), .\" depending on which changed most recently. Returns the new position of sash number \fIindex\fR. .\" Full story: new position may be different than the requested position. .SH "VIRTUAL EVENTS" .PP The panedwindow widget generates an \fB<<EnteredChild>>\fR virtual event on LeaveNotify/NotifyInferior events, because Tk does not execute binding scripts for <Leave> events when the pointer crosses from a parent to a child. The panedwindow widget needs to know when that happens. .SH "SEE ALSO" | > > > > > > > > | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | Sash positions are further constrained to be between 0 and the total size of the widget. .\" Full story: "total size" is either the -height (resp -width), .\" or the actual window height (resp actual window width), .\" depending on which changed most recently. Returns the new position of sash number \fIindex\fR. .\" Full story: new position may be different than the requested position. .PP The panedwindow widget also supports the following generic \fBttk::widget\fR widget subcommands (see \fIttk::widget(n)\fR for details): .DS .ta 5.5c 11c \fBcget\fR \fBconfigure\fR \fBinstate\fR \fBstate\fR .DE .SH "VIRTUAL EVENTS" .PP The panedwindow widget generates an \fB<<EnteredChild>>\fR virtual event on LeaveNotify/NotifyInferior events, because Tk does not execute binding scripts for <Leave> events when the pointer crosses from a parent to a child. The panedwindow widget needs to know when that happens. .SH "SEE ALSO" |
︙ | ︙ |
Changes to doc/ttk_progressbar.n.
︙ | ︙ | |||
20 21 22 23 24 25 26 | \fIindeterminate\fR mode provides an animated display to let the user know that something is happening. .SO ttk_widget \-class \-cursor \-takefocus \-style .SE .SH "WIDGET-SPECIFIC OPTIONS" | < < < < < > > > > > > > > > > > > < < < < < < < | 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 | \fIindeterminate\fR mode provides an animated display to let the user know that something is happening. .SO ttk_widget \-class \-cursor \-takefocus \-style .SE .SH "WIDGET-SPECIFIC OPTIONS" .OP \-length length Length Specifies the length of the long axis of the progress bar (width if horizontal, height if vertical). .OP \-maximum maximum Maximum A floating point number specifying the maximum \fB\-value\fR. Defaults to 100. .OP \-mode mode Mode One of \fBdeterminate\fR or \fBindeterminate\fR. .OP \-orient orient Orient One of \fBhorizontal\fR or \fBvertical\fR. Specifies the orientation of the progress bar. .OP \-phase phase Phase Read-only option. The widget periodically increments the value of this option whenever the \fB\-value\fR is greater than 0 and, in \fIdeterminate\fR mode, less than \fB\-maximum\fR. This option may be used by the current theme to provide additional animation effects. .OP \-value value Value The current value of the progress bar. In \fIdeterminate\fR mode, this represents the amount of work completed. In \fIindeterminate\fR mode, it is interpreted modulo \fB\-maximum\fR; that is, the progress bar completes one .QW cycle when the \fB\-value\fR increases by \fB\-maximum\fR. .OP \-variable variable Variable The name of a global Tcl variable which is linked to the \fB\-value\fR. If specified, the \fB\-value\fR of the progress bar is automatically set to the value of the variable whenever the latter is modified. .SH "WIDGET COMMAND" .PP .TP \fIpathName \fBcget \fIoption\fR Returns the current value of the specified \fIoption\fR; see \fIttk::widget(n)\fR. .TP \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? |
︙ | ︙ |
Changes to doc/ttk_separator.n.
︙ | ︙ | |||
13 14 15 16 17 18 19 | \fBttk::separator\fR \fIpathName \fR?\fIoptions\fR? .BE .SH DESCRIPTION .PP A \fBttk::separator\fR widget displays a horizontal or vertical separator bar. .SO ttk_widget | | > | 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 | \fBttk::separator\fR \fIpathName \fR?\fIoptions\fR? .BE .SH DESCRIPTION .PP A \fBttk::separator\fR widget displays a horizontal or vertical separator bar. .SO ttk_widget \-class \-cursor \-style \-takefocus .SE .SH "WIDGET-SPECIFIC OPTIONS" .OP \-orient orient Orient One of \fBhorizontal\fR or \fBvertical\fR. Specifies the orientation of the separator. .SH "WIDGET COMMAND" .PP Separator widgets support the standard \fBcget\fR, \fBconfigure\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR methods. No other widget methods are used. .PP .SH "SEE ALSO" ttk::widget(n) .SH "KEYWORDS" widget, separator '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/ttk_sizegrip.n.
︙ | ︙ | |||
14 15 16 17 18 19 20 | .BE .SH DESCRIPTION .PP A \fBttk::sizegrip\fR widget (also known as a \fIgrow box\fR) allows the user to resize the containing toplevel window by pressing and dragging the grip. .SO ttk_widget | | | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | .BE .SH DESCRIPTION .PP A \fBttk::sizegrip\fR widget (also known as a \fIgrow box\fR) allows the user to resize the containing toplevel window by pressing and dragging the grip. .SO ttk_widget \-class \-cursor \-style \-takefocus .SE .SH "WIDGET COMMAND" .PP Sizegrip widgets support the standard \fBcget\fR, \fBconfigure\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR methods. No other widget methods are used. |
︙ | ︙ |
Changes to doc/ttk_spinbox.n.
︙ | ︙ | |||
17 18 19 20 21 22 23 | A \fBttk::spinbox\fR widget is a \fBttk::entry\fR widget with built-in up and down buttons that are used to either modify a numeric value or to select among a set of values. The widget implements all the features of the \fBttk::entry\fR widget including support of the \fB\-textvariable\fR option to link the value displayed by the widget to a Tcl variable. .SO ttk_widget | | > > > > > > > < < < < > > > > < < < < < < < < < | 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 66 67 68 69 70 71 72 73 74 75 76 | A \fBttk::spinbox\fR widget is a \fBttk::entry\fR widget with built-in up and down buttons that are used to either modify a numeric value or to select among a set of values. The widget implements all the features of the \fBttk::entry\fR widget including support of the \fB\-textvariable\fR option to link the value displayed by the widget to a Tcl variable. .SO ttk_widget \-class \-cursor \-state \-style \-takefocus \-xscrollcommand .SE .SO ttk_entry \-validate \-validatecommand .SE .SH "WIDGET-SPECIFIC OPTIONS" .OP \-command command Command Specifies a Tcl command to be invoked whenever a spinbutton is invoked. .OP \-format format Format Specifies an alternate format to use when setting the string value when using the \fB\-from\fR and \fB\-to\fR range. This must be a format specifier of the form \fB%<pad>.<pad>f\fR, as it will format a floating-point number. .OP \-from from From A floating\-point value specifying the lowest value for the spinbox. This is used in conjunction with \fB\-to\fR and \fB\-increment\fR to set a numerical range. .OP \-increment increment Increment A floating\-point value specifying the change in value to be applied each time one of the widget spin buttons is pressed. The up button applies a positive increment, the down button applies a negative increment. .OP \-to to To A floating\-point value specifying the highest permissible value for the widget. See also \fB\-from\fR and \fB\-increment\fR. range. .OP \-values values Values This must be a Tcl list of values. If this option is set then this will override any range set using the \fB\-from\fR, \fB\-to\fR and \fB\-increment\fR options. The widget will instead use the values specified beginning with the first value. .OP \-wrap wrap Wrap Must be a proper boolean value. If on, the spinbox will wrap around the values of data in the widget. .SH "INDICES" .PP See the \fBttk::entry\fR manual for information about indexing characters. .SH "VALIDATION" .PP See the \fBttk::entry\fR manual for information about using the \fB\-validate\fR and \fB\-validatecommand\fR options. .SH "WIDGET COMMAND" .PP The following subcommands are possible for spinbox widgets in addition to the commands described for the \fBttk::entry\fR widget: .TP \fIpathName \fBget\fR Returns the spinbox's current value. .TP \fIpathName \fBset \fIvalue\fR Set the spinbox string to \fIvalue\fR. If a \fB\-format\fR option has been configured then this format will be applied. If formatting fails or is not set or the \fB\-values\fR option has been used then the value |
︙ | ︙ |
Changes to doc/ttk_widget.n.
︙ | ︙ | |||
121 122 123 124 125 126 127 128 129 130 131 132 133 134 | The underlined character is used for mnemonic activation. .OP \-width width Width If greater than zero, specifies how much space, in character widths, to allocate for the text label. If less than zero, specifies a minimum width. If zero or unspecified, the natural width of the text label is used. .SH "COMPATIBILITY OPTIONS" .OP \-state state State May be set to \fBnormal\fR or \fBdisabled\fR to control the \fBdisabled\fR state bit. This is a write-only option: setting it changes the widget state, but the \fBstate\fR widget command does not affect the \fB\-state\fR option. | > > > | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | The underlined character is used for mnemonic activation. .OP \-width width Width If greater than zero, specifies how much space, in character widths, to allocate for the text label. If less than zero, specifies a minimum width. If zero or unspecified, the natural width of the text label is used. .SH "COMPATIBILITY OPTIONS" This option is only available for themed widgets that have .QW corresponding traditional Tk widgets. .OP \-state state State May be set to \fBnormal\fR or \fBdisabled\fR to control the \fBdisabled\fR state bit. This is a write-only option: setting it changes the widget state, but the \fBstate\fR widget command does not affect the \fB\-state\fR option. |
︙ | ︙ |
Changes to doc/wm.n.
︙ | ︙ | |||
484 485 486 487 488 489 490 | vice versa. .PP On X, the images are arranged into the _NET_WM_ICON X property, which most modern window managers support. A \fBwm iconbitmap\fR may exist simultaneously. It is recommended to use not more than 2 icons, placing the larger icon first. .PP | | > > > > > > | 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | vice versa. .PP On X, the images are arranged into the _NET_WM_ICON X property, which most modern window managers support. A \fBwm iconbitmap\fR may exist simultaneously. It is recommended to use not more than 2 icons, placing the larger icon first. .PP On Macintosh, the first image called is loaded into an OSX-native icon format, and becomes the application icon in dialogs, the Dock, and other contexts. At the script level the command will accept only the first image passed in the parameters as support for multiple sizes/resolutions on macOS is outside Tk's scope. Developers should use the largest icon they can support (preferably 512 pixels) to ensure smooth rendering on the Mac. .RE .TP \fBwm iconposition \fIwindow\fR ?\fIx y\fR? . If \fIx\fR and \fIy\fR are specified, they are passed to the window manager as a hint about where to position the icon for \fIwindow\fR. In this case an empty string is returned. If \fIx\fR and \fIy\fR are |
︙ | ︙ |
Changes to generic/tk.h.
︙ | ︙ | |||
71 72 73 74 75 76 77 | * You may also need to update some of these files when the numbers change for * the version of Tcl that this release of Tk is compiled against. */ #define TK_MAJOR_VERSION 8 #define TK_MINOR_VERSION 6 #define TK_RELEASE_LEVEL TCL_FINAL_RELEASE | | | | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | * You may also need to update some of these files when the numbers change for * the version of Tcl that this release of Tk is compiled against. */ #define TK_MAJOR_VERSION 8 #define TK_MINOR_VERSION 6 #define TK_RELEASE_LEVEL TCL_FINAL_RELEASE #define TK_RELEASE_SERIAL 8 #define TK_VERSION "8.6" #define TK_PATCH_LEVEL "8.6.8" /* * A special definition used to allow this header file to be included from * windows or mac resource files so that they can obtain version information. * RC_INVOKED is defined by default by the windows RC tool and manually set * for macintosh. * |
︙ | ︙ |
Changes to generic/tkBind.c.
︙ | ︙ | |||
1734 1735 1736 1737 1738 1739 1740 | if ((state & modMask) != modMask) { goto nextSequence; } } if (psPtr->flags & PAT_NEARBY) { XEvent *firstPtr = &bindPtr->eventRing[bindPtr->curEvent]; | | > | | 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 | if ((state & modMask) != modMask) { goto nextSequence; } } if (psPtr->flags & PAT_NEARBY) { XEvent *firstPtr = &bindPtr->eventRing[bindPtr->curEvent]; long timeDiff; timeDiff = ((long)firstPtr->xkey.time - (long)eventPtr->xkey.time); if ((firstPtr->xkey.x_root < (eventPtr->xkey.x_root - NEARBY_PIXELS)) || (firstPtr->xkey.x_root > (eventPtr->xkey.x_root + NEARBY_PIXELS)) || (firstPtr->xkey.y_root < (eventPtr->xkey.y_root - NEARBY_PIXELS)) || (firstPtr->xkey.y_root |
︙ | ︙ | |||
3329 3330 3331 3332 3333 3334 3335 | } break; case EVENT_TIME: if (Tcl_GetIntFromObj(interp, valuePtr, &number) != TCL_OK) { return TCL_ERROR; } if (flags & KEY_BUTTON_MOTION_CROSSING) { | | | | 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 | } break; case EVENT_TIME: if (Tcl_GetIntFromObj(interp, valuePtr, &number) != TCL_OK) { return TCL_ERROR; } if (flags & KEY_BUTTON_MOTION_CROSSING) { event.general.xkey.time = number; } else if (flags & PROP) { event.general.xproperty.time = number; } else { goto badopt; } break; case EVENT_WIDTH: if (Tk_GetPixelsFromObj(interp,tkwin,valuePtr,&number) != TCL_OK) { return TCL_ERROR; |
︙ | ︙ | |||
3462 3463 3464 3465 3466 3467 3468 | /* * We only allow warping if the window is mapped. */ if ((warp != 0) && Tk_IsMapped(tkwin)) { TkDisplay *dispPtr = TkGetDisplay(event.general.xmotion.display); | | | 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 | /* * We only allow warping if the window is mapped. */ if ((warp != 0) && Tk_IsMapped(tkwin)) { TkDisplay *dispPtr = TkGetDisplay(event.general.xmotion.display); Tk_Window warpWindow = Tk_IdToWindow(dispPtr->display, event.general.xmotion.window); if (!(dispPtr->flags & TK_DISPLAY_IN_WARP)) { Tcl_DoWhenIdle(DoWarp, dispPtr); dispPtr->flags |= TK_DISPLAY_IN_WARP; } |
︙ | ︙ |
Changes to generic/tkBusy.c.
︙ | ︙ | |||
13 14 15 16 17 18 19 | */ #include "tkInt.h" #include "tkBusy.h" #include "default.h" /* | | | < < | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | */ #include "tkInt.h" #include "tkBusy.h" #include "default.h" /* * Things about the busy system that may be configured. Note that on some * platforms this may or may not have an effect. */ static const Tk_OptionSpec busyOptionSpecs[] = { {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_BUSY_CURSOR, -1, Tk_Offset(Busy, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; /* * Forward declarations of functions defined in this file. */ |
︙ | ︙ |
Changes to generic/tkButton.c.
︙ | ︙ | |||
1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 | const char *name1, /* Name of variable. */ const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { register TkButton *butPtr = clientData; const char *value; Tcl_Obj *valuePtr; /* * If the variable is being unset, then just re-establish the trace unless * the whole interpreter is going away. */ if (flags & TCL_TRACE_UNSETS) { | > > > > > > > > > > > > > | 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 | const char *name1, /* Name of variable. */ const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { register TkButton *butPtr = clientData; const char *value; Tcl_Obj *valuePtr; /* * See ticket [5d991b82]. */ if (butPtr->selVarNamePtr == NULL) { if (!(flags & TCL_INTERP_DESTROYED)) { Tcl_UntraceVar2(interp, name1, name2, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, ButtonVarProc, clientData); } return NULL; } /* * If the variable is being unset, then just re-establish the trace unless * the whole interpreter is going away. */ if (flags & TCL_TRACE_UNSETS) { |
︙ | ︙ | |||
1688 1689 1690 1691 1692 1693 1694 | */ /* ARGSUSED */ static char * ButtonTextVarProc( ClientData clientData, /* Information about button. */ Tcl_Interp *interp, /* Interpreter containing variable. */ | | | > > > > > > > > > > > > > | 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 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 | */ /* ARGSUSED */ static char * ButtonTextVarProc( ClientData clientData, /* Information about button. */ Tcl_Interp *interp, /* Interpreter containing variable. */ const char *name1, /* Name of variable. */ const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { TkButton *butPtr = clientData; Tcl_Obj *valuePtr; if (butPtr->flags & BUTTON_DELETED) { return NULL; } /* * See ticket [5d991b82]. */ if (butPtr->textVarNamePtr == NULL) { if (!(flags & TCL_INTERP_DESTROYED)) { Tcl_UntraceVar2(interp, name1, name2, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, ButtonTextVarProc, clientData); } return NULL; } /* * If the variable is unset, then immediately recreate it unless the whole * interpreter is going away. */ if (flags & TCL_TRACE_UNSETS) { if ((flags & TCL_TRACE_DESTROYED) && !(flags & TCL_INTERP_DESTROYED)) { |
︙ | ︙ |
Changes to generic/tkCanvas.c.
︙ | ︙ | |||
264 265 266 267 268 269 270 271 272 273 274 275 276 277 | Tcl_Interp *interp, int argc, Tcl_Obj *const *argv); static void CanvasWorldChanged(ClientData instanceData); static int ConfigureCanvas(Tcl_Interp *interp, TkCanvas *canvasPtr, int argc, Tcl_Obj *const *argv, int flags); static void DestroyCanvas(char *memPtr); static void DisplayCanvas(ClientData clientData); static void DoItem(Tcl_Obj *accumObj, Tk_Item *itemPtr, Tk_Uid tag); static void EventuallyRedrawItem(TkCanvas *canvasPtr, Tk_Item *itemPtr); #ifdef USE_OLD_TAG_SEARCH static int FindItems(Tcl_Interp *interp, TkCanvas *canvasPtr, | > | 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | Tcl_Interp *interp, int argc, Tcl_Obj *const *argv); static void CanvasWorldChanged(ClientData instanceData); static int ConfigureCanvas(Tcl_Interp *interp, TkCanvas *canvasPtr, int argc, Tcl_Obj *const *argv, int flags); static void DestroyCanvas(char *memPtr); static int DrawCanvas(Tcl_Interp *interp, ClientData clientData, Tk_PhotoHandle photohandle, int subsample, int zoom); static void DisplayCanvas(ClientData clientData); static void DoItem(Tcl_Obj *accumObj, Tk_Item *itemPtr, Tk_Uid tag); static void EventuallyRedrawItem(TkCanvas *canvasPtr, Tk_Item *itemPtr); #ifdef USE_OLD_TAG_SEARCH static int FindItems(Tcl_Interp *interp, TkCanvas *canvasPtr, |
︙ | ︙ | |||
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 | int index; static const char *const optionStrings[] = { "addtag", "bbox", "bind", "canvasx", "canvasy", "cget", "configure", "coords", "create", "dchars", "delete", "dtag", "find", "focus", "gettags", "icursor", "imove", "index", "insert", "itemcget", "itemconfigure", "lower", "move", "moveto", "postscript", "raise", "rchars", "scale", "scan", "select", "type", "xview", "yview", NULL }; enum options { CANV_ADDTAG, CANV_BBOX, CANV_BIND, CANV_CANVASX, CANV_CANVASY, CANV_CGET, CANV_CONFIGURE, CANV_COORDS, CANV_CREATE, CANV_DCHARS, CANV_DELETE, CANV_DTAG, CANV_FIND, CANV_FOCUS, CANV_GETTAGS, CANV_ICURSOR, CANV_IMOVE, CANV_INDEX, CANV_INSERT, CANV_ITEMCGET, CANV_ITEMCONFIGURE, CANV_LOWER, CANV_MOVE, CANV_MOVETO, CANV_POSTSCRIPT, CANV_RAISE, CANV_RCHARS, CANV_SCALE, CANV_SCAN, CANV_SELECT, CANV_TYPE, CANV_XVIEW, CANV_YVIEW }; | > > | 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 | int index; static const char *const optionStrings[] = { "addtag", "bbox", "bind", "canvasx", "canvasy", "cget", "configure", "coords", "create", "dchars", "delete", "dtag", "find", "focus", "gettags", "icursor", "image", "imove", "index", "insert", "itemcget", "itemconfigure", "lower", "move", "moveto", "postscript", "raise", "rchars", "scale", "scan", "select", "type", "xview", "yview", NULL }; enum options { CANV_ADDTAG, CANV_BBOX, CANV_BIND, CANV_CANVASX, CANV_CANVASY, CANV_CGET, CANV_CONFIGURE, CANV_COORDS, CANV_CREATE, CANV_DCHARS, CANV_DELETE, CANV_DTAG, CANV_FIND, CANV_FOCUS, CANV_GETTAGS, CANV_ICURSOR, CANV_IMAGE, CANV_IMOVE, CANV_INDEX, CANV_INSERT, CANV_ITEMCGET, CANV_ITEMCONFIGURE, CANV_LOWER, CANV_MOVE, CANV_MOVETO, CANV_POSTSCRIPT, CANV_RAISE, CANV_RCHARS, CANV_SCALE, CANV_SCAN, CANV_SELECT, CANV_TYPE, CANV_XVIEW, CANV_YVIEW }; |
︙ | ︙ | |||
1182 1183 1184 1185 1186 1187 1188 | * modifications in the loop. */ tmpObj = Tcl_NewListObj(2, objv+4); FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto doneImove) { int index; | | | | 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 | * modifications in the loop. */ tmpObj = Tcl_NewListObj(2, objv+4); FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto doneImove) { int index; int x1, x2, y1, y2; int dontRedraw1, dontRedraw2; /* * The TK_MOVABLE_POINTS flag should only be set for types that * support the same semantics of index, dChars and insert methods * as lines and canvases. */ |
︙ | ︙ | |||
1213 1214 1215 1216 1217 1218 1219 | */ x1 = itemPtr->x1; y1 = itemPtr->y1; x2 = itemPtr->x2; y2 = itemPtr->y2; itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW; ItemDelChars(canvasPtr, itemPtr, index, index); | | | | 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 | */ x1 = itemPtr->x1; y1 = itemPtr->y1; x2 = itemPtr->x2; y2 = itemPtr->y2; itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW; ItemDelChars(canvasPtr, itemPtr, index, index); dontRedraw1 = itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW; itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW; ItemInsert(canvasPtr, itemPtr, index, tmpObj); dontRedraw2 = itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW; if (!(dontRedraw1 && dontRedraw2)) { Tk_CanvasEventuallyRedraw((Tk_Canvas) canvasPtr, x1, y1, x2, y2); EventuallyRedrawItem(canvasPtr, itemPtr); } itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW; |
︙ | ︙ | |||
1330 1331 1332 1333 1334 1335 1336 | EventuallyRedrawItem(canvasPtr, itemPtr); canvasPtr->flags |= REPICK_NEEDED; Tcl_SetObjResult(interp, Tcl_NewIntObj(itemPtr->id)); break; } case CANV_DCHARS: { int first, last; | | | 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 | EventuallyRedrawItem(canvasPtr, itemPtr); canvasPtr->flags |= REPICK_NEEDED; Tcl_SetObjResult(interp, Tcl_NewIntObj(itemPtr->id)); break; } case CANV_DCHARS: { int first, last; int x1, x2, y1, y2; if ((objc != 4) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "tagOrId first ?last?"); result = TCL_ERROR; goto done; } FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done) { |
︙ | ︙ | |||
1358 1359 1360 1361 1362 1363 1364 | } else { last = first; } /* * Redraw both item's old and new areas: it's possible that a * delete could result in a new area larger than the old area. | | | 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 | } else { last = first; } /* * Redraw both item's old and new areas: it's possible that a * delete could result in a new area larger than the old area. * Except if the dCharsProc sets the TK_ITEM_DONT_REDRAW flag, * nothing more needs to be done. */ x1 = itemPtr->x1; y1 = itemPtr->y1; x2 = itemPtr->x2; y2 = itemPtr->y2; itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW; ItemDelChars(canvasPtr, itemPtr, first, last); |
︙ | ︙ | |||
1568 1569 1570 1571 1572 1573 1574 | goto done; } Tcl_SetObjResult(interp, Tcl_NewIntObj(index)); break; } case CANV_INSERT: { int beforeThis; | | | 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 | goto done; } Tcl_SetObjResult(interp, Tcl_NewIntObj(index)); break; } case CANV_INSERT: { int beforeThis; int x1, x2, y1, y2; if (objc != 5) { Tcl_WrongNumArgs(interp, 2, objv, "tagOrId beforeThis string"); result = TCL_ERROR; goto done; } FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done) { |
︙ | ︙ | |||
1796 1797 1798 1799 1800 1801 1802 | } } RELINK_ITEMS(objv[2], prevPtr); break; } case CANV_RCHARS: { int first, last; | | > | 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 | } } RELINK_ITEMS(objv[2], prevPtr); break; } case CANV_RCHARS: { int first, last; int x1, x2, y1, y2; int dontRedraw1, dontRedraw2; if (objc != 6) { Tcl_WrongNumArgs(interp, 2, objv, "tagOrId first last string"); result = TCL_ERROR; goto done; } FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done) { |
︙ | ︙ | |||
1827 1828 1829 1830 1831 1832 1833 | * replace could result in a new area larger than the old area. * Except if the dCharsProc or insertProc sets the * TK_ITEM_DONT_REDRAW flag, nothing more needs to be done. */ x1 = itemPtr->x1; y1 = itemPtr->y1; x2 = itemPtr->x2; y2 = itemPtr->y2; | > | > > | > | | 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 | * replace could result in a new area larger than the old area. * Except if the dCharsProc or insertProc sets the * TK_ITEM_DONT_REDRAW flag, nothing more needs to be done. */ x1 = itemPtr->x1; y1 = itemPtr->y1; x2 = itemPtr->x2; y2 = itemPtr->y2; itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW; ItemDelChars(canvasPtr, itemPtr, first, last); dontRedraw1 = itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW; itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW; ItemInsert(canvasPtr, itemPtr, first, objv[5]); dontRedraw2 = itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW; if (!(dontRedraw1 && dontRedraw2)) { Tk_CanvasEventuallyRedraw((Tk_Canvas) canvasPtr, x1, y1, x2, y2); EventuallyRedrawItem(canvasPtr, itemPtr); } itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW; } break; |
︙ | ︙ | |||
2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 | * (Tk_Height(canvasPtr->tkwin) - 2*canvasPtr->inset)); } break; } CanvasSetOrigin(canvasPtr, canvasPtr->xOrigin, newY); break; } } done: #ifndef USE_OLD_TAG_SEARCH TagSearchDestroy(searchPtr); #endif /* not USE_OLD_TAG_SEARCH */ Tcl_Release(canvasPtr); | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 | * (Tk_Height(canvasPtr->tkwin) - 2*canvasPtr->inset)); } break; } CanvasSetOrigin(canvasPtr, canvasPtr->xOrigin, newY); break; } case CANV_IMAGE: { Tk_PhotoHandle photohandle; int subsample = 1, zoom = 1; if (objc < 3 || objc > 5) { Tcl_WrongNumArgs(interp, 2, objv, "imagename ?subsample? ?zoom?"); result = TCL_ERROR; goto done; } if ((photohandle = Tk_FindPhoto(interp, Tcl_GetString(objv[2]) )) == 0) { result = TCL_ERROR; goto done; } /* * If we are given a subsample or a zoom then grab them. */ if (objc >= 4 && Tcl_GetIntFromObj(interp, objv[3], &subsample) != TCL_OK) { result = TCL_ERROR; goto done; } if (objc >= 5 && Tcl_GetIntFromObj(interp, objv[4], &zoom) != TCL_OK) { result = TCL_ERROR; goto done; } /* * Set the image size to zero, which allows the DrawCanvas() function * to expand the image automatically when it copies the pixmap into it. */ if (Tk_PhotoSetSize(interp, photohandle, 0, 0) != TCL_OK) { result = TCL_ERROR; goto done; } result = DrawCanvas(interp, clientData, photohandle, subsample, zoom); } } done: #ifndef USE_OLD_TAG_SEARCH TagSearchDestroy(searchPtr); #endif /* not USE_OLD_TAG_SEARCH */ Tcl_Release(canvasPtr); |
︙ | ︙ | |||
2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 | canvasPtr->flags |= REPICK_NEEDED; Tk_CanvasEventuallyRedraw((Tk_Canvas) canvasPtr, canvasPtr->xOrigin, canvasPtr->yOrigin, canvasPtr->xOrigin + Tk_Width(canvasPtr->tkwin), canvasPtr->yOrigin + Tk_Height(canvasPtr->tkwin)); } /* *---------------------------------------------------------------------- * * DisplayCanvas -- * * This function redraws the contents of a canvas window. It is invoked * as a do-when-idle handler, so it only runs when there's nothing else | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 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 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 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 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 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 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 | canvasPtr->flags |= REPICK_NEEDED; Tk_CanvasEventuallyRedraw((Tk_Canvas) canvasPtr, canvasPtr->xOrigin, canvasPtr->yOrigin, canvasPtr->xOrigin + Tk_Width(canvasPtr->tkwin), canvasPtr->yOrigin + Tk_Height(canvasPtr->tkwin)); } /* *---------------------------------------------------------------------- * * DecomposeMaskToShiftAndBits -- * * Given a 32 bit pixel mask, we find the position of the lowest bit and the * width of the mask bits. * * Results: * None. * * Side effects: * None. * *---------------------------------------------------------------------- */ static void DecomposeMaskToShiftAndBits( unsigned long mask, /* The pixel mask to examine */ int *shift, /* Where to put the shift count (position of lowest bit) */ int *bits) /* Where to put the bit count (width of the pixel mask) */ { int i; *shift = 0; *bits = 0; /* * Find the lowest '1' bit in the mask. */ for (i = 0; i < 32; ++i) { if (mask & 1 << i) break; } if (i < 32) { *shift = i; /* * Now find the next '0' bit and the width of the mask. */ for ( ; i < 32; ++i) { if ((mask & 1 << i) == 0) break; else ++*bits; } /* * Limit to the top 8 bits if the mask was wider than 8. */ if (*bits > 8) { *shift += *bits - 8; *bits = 8; } } } /* *---------------------------------------------------------------------- * * DrawCanvas -- * * This function draws the contents of a canvas into the given Photo image. * This function is called from the widget "image" subcommand. * The canvas does not need to be mapped (one of it's ancestors must be) * in order for this function to work. * * Results: * None. * * Side effects: * Canvas contents from within the -scrollregion or widget size are rendered * into the Photo. Any errors are left in the result. * *---------------------------------------------------------------------- */ #define OVERDRAW_PIXELS 32 /* How much larger we make the pixmap * that the canvas objects are drawn into */ /* From stackoverflow.com/questions/2100331/c-macro-definition-to-determine-big-endian-or-little-endian-machine */ #define IS_BIG_ENDIAN (*(unsigned short *)"\0\xff" < 0x100) #define BYTE_SWAP16(n) ((((unsigned short)n)>>8) | (((unsigned short)n)<<8)) #define BYTE_SWAP32(n) (((n>>24)&0x000000FF) | ((n<<8)&0x00FF0000) | ((n>>8)&0x0000FF00) | ((n<<24)&0xFF000000)) static int DrawCanvas( Tcl_Interp *interp, /* As passed to the widget command, and we will leave errors here */ ClientData clientData, Tk_PhotoHandle photohandle, /* The photo we are rendering into */ int subsample, /* If either subsample or zoom are not 1 then we call Tk_PhotoPutZoomedBlock() */ int zoom) { TkCanvas * canvasPtr = clientData; Tk_Window tkwin; Display *displayPtr; Tk_PhotoImageBlock blockPtr = {0}; Window wid; Tk_Item * itemPtr; Pixmap pixmap = 0; XImage *ximagePtr = NULL; Visual *visualPtr; GC xgc = 0; XGCValues xgcValues; int canvasX1, canvasY1, canvasX2, canvasY2, cWidth, cHeight, pixmapX1, pixmapY1, pixmapX2, pixmapY2, pmWidth, pmHeight, bitsPerPixel, bytesPerPixel, x, y, result = TCL_OK, rshift, gshift, bshift, rbits, gbits, bbits; #ifdef DEBUG_DRAWCANVAS char buffer[128]; #endif if ((tkwin = canvasPtr->tkwin) == NULL) { Tcl_AppendResult(interp, "canvas tkwin is NULL!", NULL); result = TCL_ERROR; goto done; } /* * If this canvas is unmapped, then we won't have a window id, so we will * try the ancestors of the canvas until we find a window that has a * valid window id. The Tk_GetPixmap() call requires a valid window id. */ do { if ((displayPtr = Tk_Display(tkwin)) == NULL) { Tcl_AppendResult(interp, "canvas (or parent) display is NULL!", NULL); result = TCL_ERROR; goto done; } if ((wid = Tk_WindowId(tkwin)) != 0) { continue; } if ((tkwin = Tk_Parent(tkwin)) == NULL) { Tcl_AppendResult(interp, "canvas has no parent with a valid window id! Is the toplevel window mapped?", NULL); result = TCL_ERROR; goto done; } } while (wid == 0); bitsPerPixel = Tk_Depth(tkwin); visualPtr = Tk_Visual(tkwin); if (subsample == 0) { Tcl_AppendResult(interp, "subsample cannot be zero", NULL); result = TCL_ERROR; goto done; } /* * Scan through the item list, registering the bounding box for all items * that didn't do that for the final coordinates yet. This can be * determined by the FORCE_REDRAW flag. */ for (itemPtr = canvasPtr -> firstItemPtr; itemPtr != NULL; itemPtr = itemPtr -> nextPtr) { if (itemPtr -> redraw_flags & FORCE_REDRAW) { itemPtr -> redraw_flags &= ~FORCE_REDRAW; EventuallyRedrawItem(canvasPtr, itemPtr); itemPtr -> redraw_flags &= ~FORCE_REDRAW; } } /* * The DisplayCanvas() function works out the region that needs redrawing, * but we don't do this. We grab the whole scrollregion or canvas window * area. If we have a defined -scrollregion we use that as the drawing * region, otherwise use the canvas window height and width with an origin * of 0,0. */ if (canvasPtr->scrollX1 != 0 || canvasPtr->scrollY1 != 0 || canvasPtr->scrollX2 != 0 || canvasPtr->scrollY2 != 0) { canvasX1 = canvasPtr->scrollX1; canvasY1 = canvasPtr->scrollY1; canvasX2 = canvasPtr->scrollX2; canvasY2 = canvasPtr->scrollY2; cWidth = canvasX2 - canvasX1 + 1; cHeight = canvasY2 - canvasY1 + 1; } else { cWidth = Tk_Width(tkwin); cHeight = Tk_Height(tkwin); canvasX1 = 0; canvasY1 = 0; canvasX2 = canvasX1 + cWidth - 1; canvasY2 = canvasY1 + cHeight - 1; } /* * Allocate a pixmap to draw into. We add OVERDRAW_PIXELS in the same way * that DisplayCanvas() does to avoid problems on some systems when objects * are being drawn too close to the edge. */ pixmapX1 = canvasX1 - OVERDRAW_PIXELS; pixmapY1 = canvasY1 - OVERDRAW_PIXELS; pixmapX2 = canvasX2 + OVERDRAW_PIXELS; pixmapY2 = canvasY2 + OVERDRAW_PIXELS; pmWidth = pixmapX2 - pixmapX1 + 1; pmHeight = pixmapY2 - pixmapY1 + 1; if ((pixmap = Tk_GetPixmap(displayPtr, Tk_WindowId(tkwin), pmWidth, pmHeight, bitsPerPixel)) == 0) { Tcl_AppendResult(interp, "failed to create drawing Pixmap", NULL); result = TCL_ERROR; goto done; } /* * Before we can draw the canvas objects into the pixmap it's background * should be filled with canvas background colour. */ xgcValues.function = GXcopy; xgcValues.foreground = Tk_3DBorderColor(canvasPtr->bgBorder)->pixel; xgc = XCreateGC(displayPtr, pixmap, GCFunction|GCForeground, &xgcValues); XFillRectangle(displayPtr,pixmap,xgc,0,0,pmWidth,pmHeight); /* * Draw all the cavas items into the pixmap */ canvasPtr->drawableXOrigin = pixmapX1; canvasPtr->drawableYOrigin = pixmapY1; for (itemPtr = canvasPtr->firstItemPtr; itemPtr != NULL; itemPtr = itemPtr->nextPtr) { if ((itemPtr->x1 >= pixmapX2) || (itemPtr->y1 >= pixmapY2) || (itemPtr->x2 < pixmapX1) || (itemPtr->y2 < pixmapY1)) { if (!AlwaysRedraw(itemPtr)) { continue; } } if (itemPtr->state == TK_STATE_HIDDEN || (itemPtr->state == TK_STATE_NULL && canvasPtr->canvas_state == TK_STATE_HIDDEN)) { continue; } ItemDisplay(canvasPtr, itemPtr, pixmap, pixmapX1, pixmapY1, pmWidth, pmHeight); } /* * Copy the Pixmap into an ZPixmap format XImage so we can copy it across * to the photo image. This seems to be the only way to get Pixmap image * data out of an image. Note we have to account for the OVERDRAW_PIXELS * border width. */ if ((ximagePtr = XGetImage(displayPtr, pixmap, -pixmapX1, -pixmapY1, cWidth, cHeight, AllPlanes, ZPixmap)) == NULL) { Tcl_AppendResult(interp, "failed to copy Pixmap to XImage", NULL); result = TCL_ERROR; goto done; } #ifdef DEBUG_DRAWCANVAS Tcl_AppendResult(interp, "ximagePtr {", NULL); sprintf(buffer,"%d",ximagePtr->width); Tcl_AppendResult(interp, " width ", buffer, NULL); sprintf(buffer,"%d",ximagePtr->height); Tcl_AppendResult(interp, " height ", buffer, NULL); sprintf(buffer,"%d",ximagePtr->xoffset); Tcl_AppendResult(interp, " xoffset ", buffer, NULL); sprintf(buffer,"%d",ximagePtr->format); Tcl_AppendResult(interp, " format ", buffer, NULL); Tcl_AppendResult(interp, " ximagePtr->data", NULL); if (ximagePtr->data != NULL) { int ix, iy; Tcl_AppendResult(interp, " {", NULL); for (iy = 0; iy < ximagePtr->height; ++ iy) { Tcl_AppendResult(interp, " {", NULL); for (ix = 0; ix < ximagePtr->bytes_per_line; ++ ix) { if (ix > 0) { if (ix % 4 == 0) Tcl_AppendResult(interp, "-", NULL); else Tcl_AppendResult(interp, " ", NULL); } sprintf(buffer,"%2.2x",ximagePtr->data[ximagePtr->bytes_per_line * iy + ix]&0xFF); Tcl_AppendResult(interp, buffer, NULL); } Tcl_AppendResult(interp, " }", NULL); } Tcl_AppendResult(interp, " }", NULL); } else sprintf(buffer," NULL"); sprintf(buffer,"%d",ximagePtr->byte_order); Tcl_AppendResult(interp, " byte_order ", buffer, NULL); sprintf(buffer,"%d",ximagePtr->bitmap_unit); Tcl_AppendResult(interp, " bitmap_unit ", buffer, NULL); sprintf(buffer,"%d",ximagePtr->bitmap_bit_order); Tcl_AppendResult(interp, " bitmap_bit_order ", buffer, NULL); sprintf(buffer,"%d",ximagePtr->bitmap_pad); Tcl_AppendResult(interp, " bitmap_pad ", buffer, NULL); sprintf(buffer,"%d",ximagePtr->depth); Tcl_AppendResult(interp, " depth ", buffer, NULL); sprintf(buffer,"%d",ximagePtr->bytes_per_line); Tcl_AppendResult(interp, " bytes_per_line ", buffer, NULL); sprintf(buffer,"%d",ximagePtr->bits_per_pixel); Tcl_AppendResult(interp, " bits_per_pixel ", buffer, NULL); sprintf(buffer,"0x%8.8lx",ximagePtr->red_mask); Tcl_AppendResult(interp, " red_mask ", buffer, NULL); sprintf(buffer,"0x%8.8lx",ximagePtr->green_mask); Tcl_AppendResult(interp, " green_mask ", buffer, NULL); sprintf(buffer,"0x%8.8lx",ximagePtr->blue_mask); Tcl_AppendResult(interp, " blue_mask ", buffer, NULL); Tcl_AppendResult(interp, " }", NULL); Tcl_AppendResult(interp, "\nvisualPtr {", NULL); sprintf(buffer,"0x%8.8lx",visualPtr->red_mask); Tcl_AppendResult(interp, " red_mask ", buffer, NULL); sprintf(buffer,"0x%8.8lx",visualPtr->green_mask); Tcl_AppendResult(interp, " green_mask ", buffer, NULL); sprintf(buffer,"0x%8.8lx",visualPtr->blue_mask); Tcl_AppendResult(interp, " blue_mask ", buffer, NULL); Tcl_AppendResult(interp, " }", NULL); #endif /* * Fill in the PhotoImageBlock structure abd allocate a block of memory * for the converted image data. Note we allocate an alpha channel even * though we don't use one, because this layout helps Tk_PhotoPutBlock() * use memcpy() instead of the slow pixel or line copy. */ blockPtr.width = cWidth; blockPtr.height = cHeight; blockPtr.pixelSize = 4; blockPtr.pitch = blockPtr.pixelSize * blockPtr.width; blockPtr.offset[0] = 0; blockPtr.offset[1] = 1; blockPtr.offset[2] = 2; blockPtr.offset[3] = 3; blockPtr.pixelPtr = ckalloc(blockPtr.pixelSize * blockPtr.height * blockPtr.width); /* * Now convert the image data pixel by pixel from XImage to 32bit RGBA * format suitable for Tk_PhotoPutBlock(). */ DecomposeMaskToShiftAndBits(visualPtr->red_mask,&rshift,&rbits); DecomposeMaskToShiftAndBits(visualPtr->green_mask,&gshift,&gbits); DecomposeMaskToShiftAndBits(visualPtr->blue_mask,&bshift,&bbits); #ifdef DEBUG_DRAWCANVAS sprintf(buffer,"%d",rshift); Tcl_AppendResult(interp, "\nbits { rshift ", buffer, NULL); sprintf(buffer,"%d",gshift); Tcl_AppendResult(interp, " gshift ", buffer, NULL); sprintf(buffer,"%d",bshift); Tcl_AppendResult(interp, " bshift ", buffer, NULL); sprintf(buffer,"%d",rbits); Tcl_AppendResult(interp, " rbits ", buffer, NULL); sprintf(buffer,"%d",gbits); Tcl_AppendResult(interp, " gbits ", buffer, NULL); sprintf(buffer,"%d",bbits); Tcl_AppendResult(interp, " bbits ", buffer, " }", NULL); Tcl_AppendResult(interp, "\nConverted_image {", NULL); #endif /* Ok, had to use ximagePtr->bits_per_pixel here and in the switch (...) * below to get this to work on Windows. X11 correctly sets the bitmap *_pad and bitmap_unit fields to 32, but on Windows they are 0 and 8 * respectively! */ bytesPerPixel = ximagePtr->bits_per_pixel/8; for (y = 0; y < blockPtr.height; ++y) { #ifdef DEBUG_DRAWCANVAS Tcl_AppendResult(interp, " {", NULL); #endif for(x = 0; x < blockPtr.width; ++x) { unsigned long pixel; switch (ximagePtr->bits_per_pixel) { /* * Get an 8 bit pixel from the XImage. */ case 8 : pixel = *((unsigned char *)(ximagePtr->data + bytesPerPixel * x + ximagePtr->bytes_per_line * y)); break; /* * Get a 16 bit pixel from the XImage, and correct the * byte order as necessary. */ case 16 : pixel = *((unsigned short *)(ximagePtr->data + bytesPerPixel * x + ximagePtr->bytes_per_line * y)); if ((IS_BIG_ENDIAN && ximagePtr->byte_order == LSBFirst) || (!IS_BIG_ENDIAN && ximagePtr->byte_order == MSBFirst)) pixel = BYTE_SWAP16(pixel); break; /* * Grab a 32 bit pixel from the XImage, and correct the * byte order as necessary. */ case 32 : pixel = *((unsigned long *)(ximagePtr->data + bytesPerPixel * x + ximagePtr->bytes_per_line * y)); if ((IS_BIG_ENDIAN && ximagePtr->byte_order == LSBFirst) || (!IS_BIG_ENDIAN && ximagePtr->byte_order == MSBFirst)) pixel = BYTE_SWAP32(pixel); break; } /* * We have a pixel with the correct byte order, so pull out the * colours and place them in the photo block. Perhaps we could * just not bother with the alpha byte because we are using * TK_PHOTO_COMPOSITE_SET later? * ***Windows: We have to swap the red and blue values. The * XImage storage is B - G - R - A which becomes a 32bit ARGB * quad. However the visual mask is a 32bit ABGR quad. And * Tk_PhotoPutBlock() wants R-G-B-A which is a 32bit ABGR quad. * If the visual mask was correct there would be no need to * swap anything here. */ #ifdef _WIN32 #define R_OFFSET 2 #define B_OFFSET 0 #else #define R_OFFSET 0 #define B_OFFSET 2 #endif blockPtr.pixelPtr[blockPtr.pitch * y + blockPtr.pixelSize * x + R_OFFSET] = (unsigned char)((pixel & visualPtr->red_mask) >> rshift); blockPtr.pixelPtr[blockPtr.pitch * y + blockPtr.pixelSize * x +1] = (unsigned char)((pixel & visualPtr->green_mask) >> gshift); blockPtr.pixelPtr[blockPtr.pitch * y + blockPtr.pixelSize * x + B_OFFSET] = (unsigned char)((pixel & visualPtr->blue_mask) >> bshift); blockPtr.pixelPtr[blockPtr.pitch * y + blockPtr.pixelSize * x +3] = 0xFF; #ifdef DEBUG_DRAWCANVAS { int ix; if (x > 0) Tcl_AppendResult(interp, "-", NULL); for (ix = 0; ix < 4; ++ix) { if (ix > 0) Tcl_AppendResult(interp, " ", NULL); sprintf(buffer,"%2.2x",blockPtr.pixelPtr[blockPtr.pitch * y + blockPtr.pixelSize * x + ix]&0xFF); Tcl_AppendResult(interp, buffer, NULL); } } #endif } #ifdef DEBUG_DRAWCANVAS Tcl_AppendResult(interp, " }", NULL); #endif } #ifdef DEBUG_DRAWCANVAS Tcl_AppendResult(interp, " }", NULL); #endif /* * Now put the copied pixmap into the photo. * If either zoom or subsample are not 1, we use the zoom function. */ if (subsample != 1 || zoom != 1) { if ((result = Tk_PhotoPutZoomedBlock(interp, photohandle, &blockPtr, 0, 0, cWidth * zoom / subsample, cHeight * zoom / subsample, zoom, zoom, subsample, subsample, TK_PHOTO_COMPOSITE_SET)) != TCL_OK) { goto done; } } else { if ((result = Tk_PhotoPutBlock(interp, photohandle, &blockPtr, 0, 0, cWidth, cHeight, TK_PHOTO_COMPOSITE_SET)) != TCL_OK) { goto done; } } /* * Clean up anything we have allocated and exit. */ done: if (blockPtr.pixelPtr) ckfree(blockPtr.pixelPtr); if (pixmap) Tk_FreePixmap(Tk_Display(tkwin), pixmap); if (ximagePtr) XDestroyImage(ximagePtr); if (xgc) XFreeGC(displayPtr,xgc); return result; } /* *---------------------------------------------------------------------- * * DisplayCanvas -- * * This function redraws the contents of a canvas window. It is invoked * as a do-when-idle handler, so it only runs when there's nothing else |
︙ | ︙ |
Changes to generic/tkEntry.c.
︙ | ︙ | |||
883 884 885 886 887 888 889 | entryPtr->selectFirst = -1; entryPtr->selectLast = -1; } else { entryPtr->selectFirst = index; entryPtr->selectLast = index2; } if (!(entryPtr->flags & GOT_SELECTION) | | > | 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 | entryPtr->selectFirst = -1; entryPtr->selectLast = -1; } else { entryPtr->selectFirst = index; entryPtr->selectLast = index2; } if (!(entryPtr->flags & GOT_SELECTION) && (entryPtr->exportSelection) && (!Tcl_IsSafe(entryPtr->interp))) { Tk_OwnSelection(entryPtr->tkwin, XA_PRIMARY, EntryLostSelection, entryPtr); entryPtr->flags |= GOT_SELECTION; } EventuallyRedraw(entryPtr); break; |
︙ | ︙ | |||
1118 1119 1120 1121 1122 1123 1124 | } /* * Store old values that we need to effect certain behavior if they change * value. */ | | | 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 | } /* * Store old values that we need to effect certain behavior if they change * value. */ oldExport = (entryPtr->exportSelection) && (!Tcl_IsSafe(entryPtr->interp)); if (entryPtr->type == TK_SPINBOX) { oldValues = sbPtr->valueStr; oldFormat = sbPtr->reqFormat; oldFrom = sbPtr->fromValue; oldTo = sbPtr->toValue; } |
︙ | ︙ | |||
1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 | } /* * Claim the selection if we've suddenly started exporting it. */ if (entryPtr->exportSelection && (!oldExport) && (entryPtr->selectFirst != -1) && !(entryPtr->flags & GOT_SELECTION)) { Tk_OwnSelection(entryPtr->tkwin, XA_PRIMARY, EntryLostSelection, entryPtr); entryPtr->flags |= GOT_SELECTION; } | > | 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 | } /* * Claim the selection if we've suddenly started exporting it. */ if (entryPtr->exportSelection && (!oldExport) && (!Tcl_IsSafe(entryPtr->interp)) && (entryPtr->selectFirst != -1) && !(entryPtr->flags & GOT_SELECTION)) { Tk_OwnSelection(entryPtr->tkwin, XA_PRIMARY, EntryLostSelection, entryPtr); entryPtr->flags |= GOT_SELECTION; } |
︙ | ︙ | |||
2741 2742 2743 2744 2745 2746 2747 | { int newFirst, newLast; /* * Grab the selection if we don't own it already. */ | | > | 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 | { int newFirst, newLast; /* * Grab the selection if we don't own it already. */ if (!(entryPtr->flags & GOT_SELECTION) && (entryPtr->exportSelection) && (!Tcl_IsSafe(entryPtr->interp))) { Tk_OwnSelection(entryPtr->tkwin, XA_PRIMARY, EntryLostSelection, entryPtr); entryPtr->flags |= GOT_SELECTION; } /* * Pick new starting and ending points for the selection. |
︙ | ︙ | |||
2808 2809 2810 2811 2812 2813 2814 | * not including terminating NUL character. */ { Entry *entryPtr = clientData; int byteCount; const char *string; const char *selStart, *selEnd; | | > | 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 | * not including terminating NUL character. */ { Entry *entryPtr = clientData; int byteCount; const char *string; const char *selStart, *selEnd; if ((entryPtr->selectFirst < 0) || (!entryPtr->exportSelection) || Tcl_IsSafe(entryPtr->interp)) { return -1; } string = entryPtr->displayString; selStart = Tcl_UtfAtIndex(string, entryPtr->selectFirst); selEnd = Tcl_UtfAtIndex(selStart, entryPtr->selectLast - entryPtr->selectFirst); byteCount = selEnd - selStart - offset; |
︙ | ︙ | |||
2861 2862 2863 2864 2865 2866 2867 | * On Windows and Mac systems, we want to remember the selection for the * next time the focus enters the window. On Unix, we need to clear the * selection since it is always visible. * This is controlled by ::tk::AlwaysShowSelection. */ if (TkpAlwaysShowSelection(entryPtr->tkwin) | | > | 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 | * On Windows and Mac systems, we want to remember the selection for the * next time the focus enters the window. On Unix, we need to clear the * selection since it is always visible. * This is controlled by ::tk::AlwaysShowSelection. */ if (TkpAlwaysShowSelection(entryPtr->tkwin) && (entryPtr->selectFirst >= 0) && entryPtr->exportSelection && (!Tcl_IsSafe(entryPtr->interp))) { entryPtr->selectFirst = -1; entryPtr->selectLast = -1; EventuallyRedraw(entryPtr); } } /* |
︙ | ︙ | |||
3126 3127 3128 3129 3130 3131 3132 | */ /* ARGSUSED */ static char * EntryTextVarProc( ClientData clientData, /* Information about button. */ Tcl_Interp *interp, /* Interpreter containing variable. */ | | | > > > > > > > > > > > > > | 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 | */ /* ARGSUSED */ static char * EntryTextVarProc( ClientData clientData, /* Information about button. */ Tcl_Interp *interp, /* Interpreter containing variable. */ const char *name1, /* Name of variable. */ const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { Entry *entryPtr = clientData; const char *value; if (entryPtr->flags & ENTRY_DELETED) { /* * Just abort early if we entered here while being deleted. */ return NULL; } /* * See ticket [5d991b82]. */ if (entryPtr->textVarName == NULL) { if (!(flags & TCL_INTERP_DESTROYED)) { Tcl_UntraceVar2(interp, name1, name2, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, EntryTextVarProc, clientData); } return NULL; } /* * If the variable is unset, then immediately recreate it unless the whole * interpreter is going away. */ if (flags & TCL_TRACE_UNSETS) { |
︙ | ︙ | |||
4030 4031 4032 4033 4034 4035 4036 | entryPtr->selectFirst = -1; entryPtr->selectLast = -1; } else { entryPtr->selectFirst = index; entryPtr->selectLast = index2; } if (!(entryPtr->flags & GOT_SELECTION) | | > | 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 | entryPtr->selectFirst = -1; entryPtr->selectLast = -1; } else { entryPtr->selectFirst = index; entryPtr->selectLast = index2; } if (!(entryPtr->flags & GOT_SELECTION) && entryPtr->exportSelection && (!Tcl_IsSafe(entryPtr->interp))) { Tk_OwnSelection(entryPtr->tkwin, XA_PRIMARY, EntryLostSelection, entryPtr); entryPtr->flags |= GOT_SELECTION; } EventuallyRedraw(entryPtr); break; |
︙ | ︙ |
Changes to generic/tkFont.c.
︙ | ︙ | |||
3147 3148 3149 3150 3151 3152 3153 | continue; } cx[0] = cx[3] = chunkPtr->x; cy[0] = cy[1] = chunkPtr->y - fontPtr->fm.ascent; cx[1] = cx[2] = chunkPtr->x + chunkPtr->displayWidth; cy[2] = cy[3] = chunkPtr->y + fontPtr->fm.descent; | | | | | | | < < | 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 | continue; } cx[0] = cx[3] = chunkPtr->x; cy[0] = cy[1] = chunkPtr->y - fontPtr->fm.ascent; cx[1] = cx[2] = chunkPtr->x + chunkPtr->displayWidth; cy[2] = cy[3] = chunkPtr->y + fontPtr->fm.descent; if ( PointInQuadrilateral(cx, cy, rx[0], ry[0]) && PointInQuadrilateral(cx, cy, rx[1], ry[1]) && PointInQuadrilateral(cx, cy, rx[2], ry[2]) && PointInQuadrilateral(cx, cy, rx[3], ry[3])) { return 0; } } /* * If we're overlapping now, we must be partially in and out of at least * one chunk. If that is the case, there must be one line segment of the * rectangle that is touching or crossing a line segment of a chunk. */ chunkPtr = layoutPtr->chunks; for (i=0 ; i<layoutPtr->numChunks ; i++,chunkPtr++) { int j; if (chunkPtr->start[0] == '\n') { /* |
︙ | ︙ |
Changes to generic/tkGrid.c.
︙ | ︙ | |||
2864 2865 2866 2867 2868 2869 2870 | if (!(gridPtr->masterPtr->flags & REQUESTED_RELAYOUT)) { gridPtr->doubleBw = 2*Tk_Changes(gridPtr->tkwin)->border_width; gridPtr->masterPtr->flags |= REQUESTED_RELAYOUT; Tcl_DoWhenIdle(ArrangeGrid, gridPtr->masterPtr); } } } else if (eventPtr->type == DestroyNotify) { | | | | > | | | | | | | | | 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 | if (!(gridPtr->masterPtr->flags & REQUESTED_RELAYOUT)) { gridPtr->doubleBw = 2*Tk_Changes(gridPtr->tkwin)->border_width; gridPtr->masterPtr->flags |= REQUESTED_RELAYOUT; Tcl_DoWhenIdle(ArrangeGrid, gridPtr->masterPtr); } } } else if (eventPtr->type == DestroyNotify) { register Gridder *slavePtr, *nextPtr; if (gridPtr->masterPtr != NULL) { Unlink(gridPtr); } for (slavePtr = gridPtr->slavePtr; slavePtr != NULL; slavePtr = nextPtr) { Tk_ManageGeometry(slavePtr->tkwin, NULL, NULL); Tk_UnmapWindow(slavePtr->tkwin); slavePtr->masterPtr = NULL; nextPtr = slavePtr->nextPtr; slavePtr->nextPtr = NULL; } Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->gridHashTable, (char *) gridPtr->tkwin)); if (gridPtr->flags & REQUESTED_RELAYOUT) { Tcl_CancelIdleCall(ArrangeGrid, gridPtr); } gridPtr->tkwin = NULL; Tcl_EventuallyFree(gridPtr, (Tcl_FreeProc *)DestroyGrid); } else if (eventPtr->type == MapNotify) { if ((gridPtr->slavePtr != NULL) && !(gridPtr->flags & REQUESTED_RELAYOUT)) { gridPtr->flags |= REQUESTED_RELAYOUT; Tcl_DoWhenIdle(ArrangeGrid, gridPtr); } } else if (eventPtr->type == UnmapNotify) { register Gridder *slavePtr; for (slavePtr = gridPtr->slavePtr; slavePtr != NULL; slavePtr = slavePtr->nextPtr) { Tk_UnmapWindow(slavePtr->tkwin); } } } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
3079 3080 3081 3082 3083 3084 3085 | return TCL_ERROR; } defaultRow = tmp; } } /* | | > | 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 | return TCL_ERROR; } defaultRow = tmp; } } /* * If no -row is given, use the next row after the highest occupied row * of the master. */ if (defaultRow < 0) { if (masterPtr != NULL && masterPtr->masterDataPtr != NULL) { SetGridSize(masterPtr); defaultRow = masterPtr->masterDataPtr->rowEnd; } else { |
︙ | ︙ |
Changes to generic/tkImgPNG.c.
︙ | ︙ | |||
31 32 33 34 35 36 37 | 0, 0, 0, 4, 0, 2, 0, 1 }; /* * Chunk type flags. */ | | | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | 0, 0, 0, 4, 0, 2, 0, 1 }; /* * Chunk type flags. */ #define PNG_CF_ANCILLARY 0x20000000L /* Non-critical chunk (can ignore). */ #define PNG_CF_PRIVATE 0x00100000L /* Application-specific chunk. */ #define PNG_CF_RESERVED 0x00001000L /* Not used. */ #define PNG_CF_COPYSAFE 0x00000010L /* Opaque data safe for copying. */ /* * Chunk types, not all of which have support implemented. Note that there are * others in the official extension set which we will never support (as they |
︙ | ︙ | |||
980 981 982 983 984 985 986 | if (chunkType & PNG_INT32(128,128,128,128)) { /* * No nice ASCII conversion; shouldn't happen either, but * we'll be doubly careful. */ Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | | 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 | if (chunkType & PNG_INT32(128,128,128,128)) { /* * No nice ASCII conversion; shouldn't happen either, but * we'll be doubly careful. */ Tcl_SetObjResult(interp, Tcl_NewStringObj( "encountered an unsupported critical chunk type", -1)); } else { char typeString[5]; typeString[0] = (char) ((chunkType >> 24) & 255); typeString[1] = (char) ((chunkType >> 16) & 255); typeString[2] = (char) ((chunkType >> 8) & 255); typeString[3] = (char) (chunkType & 255); typeString[4] = '\0'; Tcl_SetObjResult(interp, Tcl_ObjPrintf( "encountered an unsupported critical chunk type" " \"%s\"", typeString)); } Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "UNSUPPORTED_CRITICAL", NULL); return TCL_ERROR; } |
︙ | ︙ |
Changes to generic/tkImgPhInstance.c.
︙ | ︙ | |||
414 415 416 417 418 419 420 421 422 423 424 425 426 427 | #define GetRValue(rgb) (UCHAR(((rgb) & red_mask) >> red_shift)) #define GetGValue(rgb) (UCHAR(((rgb) & green_mask) >> green_shift)) #define GetBValue(rgb) (UCHAR(((rgb) & blue_mask) >> blue_shift)) #define RGB(r, g, b) ((unsigned)( \ (UCHAR(r) << red_shift) | \ (UCHAR(g) << green_shift) | \ (UCHAR(b) << blue_shift) )) #define RGB15(r, g, b) ((unsigned)( \ (((r) * red_mask / 255) & red_mask) | \ (((g) * green_mask / 255) & green_mask) | \ (((b) * blue_mask / 255) & blue_mask) )) #endif /* !_WIN32 */ static void | > > > > > > > | 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | #define GetRValue(rgb) (UCHAR(((rgb) & red_mask) >> red_shift)) #define GetGValue(rgb) (UCHAR(((rgb) & green_mask) >> green_shift)) #define GetBValue(rgb) (UCHAR(((rgb) & blue_mask) >> blue_shift)) #define RGB(r, g, b) ((unsigned)( \ (UCHAR(r) << red_shift) | \ (UCHAR(g) << green_shift) | \ (UCHAR(b) << blue_shift) )) #ifdef MAC_OSX_TK #define RGBA(r, g, b, a) ((unsigned)( \ (UCHAR(r) << red_shift) | \ (UCHAR(g) << green_shift) | \ (UCHAR(b) << blue_shift) | \ (UCHAR(a) << alpha_shift) )) #endif #define RGB15(r, g, b) ((unsigned)( \ (((r) * red_mask / 255) & red_mask) | \ (((g) * green_mask / 255) & green_mask) | \ (((b) * blue_mask / 255) & blue_mask) )) #endif /* !_WIN32 */ static void |
︙ | ︙ | |||
481 482 483 484 485 486 487 488 489 490 491 492 493 494 | } while ((0x0001 & (green_mask >> green_shift)) == 0) { green_shift++; } while ((0x0001 & (blue_mask >> blue_shift)) == 0) { blue_shift++; } #endif /* !_WIN32 */ /* * Only UNIX requires the special case for <24bpp. It varies with 3 extra * shifts and uses RGB15. The 24+bpp version could also then be further * optimized. */ | > > > > > > > | 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 | } while ((0x0001 & (green_mask >> green_shift)) == 0) { green_shift++; } while ((0x0001 & (blue_mask >> blue_shift)) == 0) { blue_shift++; } #ifdef MAC_OSX_TK unsigned long alpha_mask = visual->alpha_mask; unsigned long alpha_shift = 0; while ((0x0001 & (alpha_mask >> alpha_shift)) == 0) { alpha_shift++; } #endif #endif /* !_WIN32 */ /* * Only UNIX requires the special case for <24bpp. It varies with 3 extra * shifts and uses RGB15. The 24+bpp version could also then be further * optimized. */ |
︙ | ︙ | |||
581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 | ga = GetGValue(pixel); ba = GetBValue(pixel); unalpha = 255 - alpha; /* Calculate once. */ r = ALPHA_BLEND(ra, r, alpha, unalpha); g = ALPHA_BLEND(ga, g, alpha, unalpha); b = ALPHA_BLEND(ba, b, alpha, unalpha); } XPutPixel(bgImg, x, y, RGB(r, g, b)); } } } #undef ALPHA_BLEND } /* | > > > > | 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 | ga = GetGValue(pixel); ba = GetBValue(pixel); unalpha = 255 - alpha; /* Calculate once. */ r = ALPHA_BLEND(ra, r, alpha, unalpha); g = ALPHA_BLEND(ga, g, alpha, unalpha); b = ALPHA_BLEND(ba, b, alpha, unalpha); } #ifndef MAC_OSX_TK XPutPixel(bgImg, x, y, RGB(r, g, b)); #else XPutPixel(bgImg, x, y, RGBA(r, g, b, alpha)); #endif } } } #undef ALPHA_BLEND } /* |
︙ | ︙ |
Changes to generic/tkImgPhoto.c.
︙ | ︙ | |||
572 573 574 575 576 577 578 579 580 581 582 583 584 585 | Tcl_GetString(options.name), NULL); return TCL_ERROR; } Tk_PhotoGetImage(srcHandle, &block); if ((options.fromX2 > block.width) || (options.fromY2 > block.height) || (options.fromX2 > block.width) || (options.fromY2 > block.height)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "coordinates for -from option extend outside source image", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", NULL); return TCL_ERROR; } | > > > | 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 | Tcl_GetString(options.name), NULL); return TCL_ERROR; } Tk_PhotoGetImage(srcHandle, &block); if ((options.fromX2 > block.width) || (options.fromY2 > block.height) || (options.fromX2 > block.width) || (options.fromY2 > block.height)) { if (options.background) { Tk_FreeColor(options.background); } Tcl_SetObjResult(interp, Tcl_NewStringObj( "coordinates for -from option extend outside source image", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", NULL); return TCL_ERROR; } |
︙ | ︙ | |||
620 621 622 623 624 625 626 | } else { height = (height - options.subsampleY - 1) / -options.subsampleY; } options.toY2 = options.toY + height * options.zoomY; } | < < < < < < < < < < < < < < | > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 | } else { height = (height - options.subsampleY - 1) / -options.subsampleY; } options.toY2 = options.toY + height * options.zoomY; } /* * Copy the image data over using Tk_PhotoPutZoomedBlock. */ block.pixelPtr += options.fromX * block.pixelSize + options.fromY * block.pitch; block.width = options.fromX2 - options.fromX; block.height = options.fromY2 - options.fromY; result = Tk_PhotoPutZoomedBlock(interp, (Tk_PhotoHandle) masterPtr, &block, options.toX, options.toY, options.toX2 - options.toX, options.toY2 - options.toY, options.zoomX, options.zoomY, options.subsampleX, options.subsampleY, options.compositingRule); /* * Set the destination image size if the -shrink option was specified. * This has to be done _after_ copying the data. Otherwise, if source * and destination are the same image, block.pixelPtr would point to * an invalid memory block (bug [5239fd749b]). */ if (options.options & OPT_SHRINK) { if (ImgPhotoSetSize(masterPtr, options.toX2, options.toY2) != TCL_OK) { if (options.background) { Tk_FreeColor(options.background); } Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); return TCL_ERROR; } } Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0, masterPtr->width, masterPtr->height); if (options.background) { Tk_FreeColor(options.background); } return result; case PHOTO_DATA: { char *data; /* * photo data command - first parse and check any options given. */ |
︙ | ︙ |
Changes to generic/tkListbox.c.
︙ | ︙ | |||
1561 1562 1563 1564 1565 1566 1567 | Tcl_Obj *const objv[]) /* Arguments. */ { Tk_SavedOptions savedOptions; Tcl_Obj *oldListObj = NULL; Tcl_Obj *errorResult = NULL; int oldExport, error; | | | 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 | Tcl_Obj *const objv[]) /* Arguments. */ { Tk_SavedOptions savedOptions; Tcl_Obj *oldListObj = NULL; Tcl_Obj *errorResult = NULL; int oldExport, error; oldExport = (listPtr->exportSelection) && (!Tcl_IsSafe(listPtr->interp)); if (listPtr->listVarName != NULL) { Tcl_UntraceVar2(interp, listPtr->listVarName, NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, ListboxListVarProc, listPtr); } for (error = 0; error <= 1; error++) { |
︙ | ︙ | |||
1603 1604 1605 1606 1607 1608 1609 | if (listPtr->highlightWidth < 0) { listPtr->highlightWidth = 0; } listPtr->inset = listPtr->highlightWidth + listPtr->borderWidth; /* * Claim the selection if we've suddenly started exporting it and | | | > | 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 | if (listPtr->highlightWidth < 0) { listPtr->highlightWidth = 0; } listPtr->inset = listPtr->highlightWidth + listPtr->borderWidth; /* * Claim the selection if we've suddenly started exporting it and * there is a selection to export and this interp is unsafe. */ if (listPtr->exportSelection && (!oldExport) && (!Tcl_IsSafe(listPtr->interp)) && (listPtr->numSelected != 0)) { Tk_OwnSelection(listPtr->tkwin, XA_PRIMARY, ListboxLostSelection, listPtr); } /* * Verify the current status of the list var. |
︙ | ︙ | |||
3075 3076 3077 3078 3079 3080 3081 | } } if (firstRedisplay >= 0) { EventuallyRedrawRange(listPtr, first, last); } if ((oldCount == 0) && (listPtr->numSelected > 0) | | > | 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 | } } if (firstRedisplay >= 0) { EventuallyRedrawRange(listPtr, first, last); } if ((oldCount == 0) && (listPtr->numSelected > 0) && (listPtr->exportSelection) && (!Tcl_IsSafe(listPtr->interp))) { Tk_OwnSelection(listPtr->tkwin, XA_PRIMARY, ListboxLostSelection, listPtr); } return TCL_OK; } /* |
︙ | ︙ | |||
3121 3122 3123 3124 3125 3126 3127 | register Listbox *listPtr = clientData; Tcl_DString selection; int length, count, needNewline, stringLen, i; Tcl_Obj *curElement; const char *stringRep; Tcl_HashEntry *entry; | | | 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 | register Listbox *listPtr = clientData; Tcl_DString selection; int length, count, needNewline, stringLen, i; Tcl_Obj *curElement; const char *stringRep; Tcl_HashEntry *entry; if ((!listPtr->exportSelection) || Tcl_IsSafe(listPtr->interp)) { return -1; } /* * Use a dynamic string to accumulate the contents of the selection. */ |
︙ | ︙ | |||
3192 3193 3194 3195 3196 3197 3198 | static void ListboxLostSelection( ClientData clientData) /* Information about listbox widget. */ { register Listbox *listPtr = clientData; | | > | 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 | static void ListboxLostSelection( ClientData clientData) /* Information about listbox widget. */ { register Listbox *listPtr = clientData; if ((listPtr->exportSelection) && (!Tcl_IsSafe(listPtr->interp)) && (listPtr->nElements > 0)) { ListboxSelect(listPtr, 0, listPtr->nElements-1, 0); GenerateListboxSelectEvent(listPtr); } } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
3424 3425 3426 3427 3428 3429 3430 | *---------------------------------------------------------------------- */ static char * ListboxListVarProc( ClientData clientData, /* Information about button. */ Tcl_Interp *interp, /* Interpreter containing variable. */ | | | > > > > > > > > > > > > > | 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 | *---------------------------------------------------------------------- */ static char * ListboxListVarProc( ClientData clientData, /* Information about button. */ Tcl_Interp *interp, /* Interpreter containing variable. */ const char *name1, /* Name of variable. */ const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { Listbox *listPtr = clientData; Tcl_Obj *oldListObj, *varListObj; int oldLength, i; Tcl_HashEntry *entry; /* * See ticket [5d991b82]. */ if (listPtr->listVarName == NULL) { if (!(flags & TCL_INTERP_DESTROYED)) { Tcl_UntraceVar2(interp, name1, name2, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, ListboxListVarProc, clientData); } return NULL; } /* * Bwah hahahaha! Puny mortal, you can't unset a -listvar'd variable! */ if (flags & TCL_TRACE_UNSETS) { if ((flags & TCL_TRACE_DESTROYED) && !(flags & TCL_INTERP_DESTROYED)) { |
︙ | ︙ |
Changes to generic/tkMenu.c.
︙ | ︙ | |||
2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 | * Do nothing if the interpreter is going away. */ return NULL; } menuPtr = mePtr->menuPtr; name = Tcl_GetString(mePtr->namePtr); /* * If the variable is being unset, then re-establish the trace. */ if (flags & TCL_TRACE_UNSETS) { | > > > > > > > > > > > > > > > > | 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 | * Do nothing if the interpreter is going away. */ return NULL; } menuPtr = mePtr->menuPtr; if (menuPtr->menuFlags & MENU_DELETION_PENDING) { return NULL; } /* * See ticket [5d991b82]. */ if (mePtr->namePtr == NULL) { Tcl_UntraceVar2(interp, name1, name2, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, MenuVarProc, clientData); return NULL; } name = Tcl_GetString(mePtr->namePtr); /* * If the variable is being unset, then re-establish the trace. */ if (flags & TCL_TRACE_UNSETS) { |
︙ | ︙ |
Changes to generic/tkMenubutton.c.
︙ | ︙ | |||
876 877 878 879 880 881 882 883 884 885 886 887 888 889 | const char *name1, /* Name of variable. */ const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { register TkMenuButton *mbPtr = clientData; const char *value; unsigned len; /* * If the variable is unset, then immediately recreate it unless the whole * interpreter is going away. */ if (flags & TCL_TRACE_UNSETS) { | > > > > > > > > > > > > > | 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 | const char *name1, /* Name of variable. */ const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { register TkMenuButton *mbPtr = clientData; const char *value; unsigned len; /* * See ticket [5d991b82]. */ if (mbPtr->textVarName == NULL) { if (!(flags & TCL_INTERP_DESTROYED)) { Tcl_UntraceVar2(interp, name1, name2, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, MenuButtonTextVarProc, clientData); } return NULL; } /* * If the variable is unset, then immediately recreate it unless the whole * interpreter is going away. */ if (flags & TCL_TRACE_UNSETS) { |
︙ | ︙ |
Changes to generic/tkMessage.c.
︙ | ︙ | |||
833 834 835 836 837 838 839 840 841 842 843 844 845 846 | Tcl_Interp *interp, /* Interpreter containing variable. */ const char *name1, /* Name of variable. */ const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { register Message *msgPtr = clientData; const char *value; /* * If the variable is unset, then immediately recreate it unless the whole * interpreter is going away. */ if (flags & TCL_TRACE_UNSETS) { | > > > > > > > > > > > > > | 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 | Tcl_Interp *interp, /* Interpreter containing variable. */ const char *name1, /* Name of variable. */ const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { register Message *msgPtr = clientData; const char *value; /* * See ticket [5d991b82]. */ if (msgPtr->textVarName == NULL) { if (!(flags & TCL_INTERP_DESTROYED)) { Tcl_UntraceVar2(interp, name1, name2, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, MessageTextVarProc, clientData); } return NULL; } /* * If the variable is unset, then immediately recreate it unless the whole * interpreter is going away. */ if (flags & TCL_TRACE_UNSETS) { |
︙ | ︙ |
Changes to generic/tkObj.c.
︙ | ︙ | |||
149 150 151 152 153 154 155 | static ThreadSpecificData * GetTypeCache(void) { ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (tsdPtr->doubleTypePtr == NULL) { | > > > > > > > | > > > > | | 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 | static ThreadSpecificData * GetTypeCache(void) { ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (tsdPtr->doubleTypePtr == NULL) { /* Smart initialization of doubleTypePtr/intTypePtr without * hash-table lookup or creating complete Tcl_Obj's */ Tcl_Obj obj; obj.length = 3; obj.bytes = (char *)"0.0"; obj.typePtr = NULL; Tcl_GetDoubleFromObj(NULL, &obj, &obj.internalRep.doubleValue); tsdPtr->doubleTypePtr = obj.typePtr; obj.bytes += 2; obj.length = 1; obj.typePtr = NULL; Tcl_GetLongFromObj(NULL, &obj, &obj.internalRep.longValue); tsdPtr->intTypePtr = obj.typePtr; } return tsdPtr; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
1108 1109 1110 1111 1112 1113 1114 | * * Registers Tk's Tcl_ObjType structures with the Tcl run-time. * * Results: * None * * Side effects: | | | 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 | * * Registers Tk's Tcl_ObjType structures with the Tcl run-time. * * Results: * None * * Side effects: * All instances of Tcl_ObjType structures used in Tk are registered with * Tcl. * *---------------------------------------------------------------------- */ void TkRegisterObjTypes(void) |
︙ | ︙ |
Changes to generic/tkPack.c.
︙ | ︙ | |||
1358 1359 1360 1361 1362 1363 1364 | packPtr->masterPtr = NULL; /* * If we have emptied this master from slaves it means we are no longer * handling it and should mark it as free. */ | | | 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 | packPtr->masterPtr = NULL; /* * If we have emptied this master from slaves it means we are no longer * handling it and should mark it as free. */ if ((masterPtr->slavePtr == NULL) && (masterPtr->flags & ALLOCED_MASTER)) { TkFreeGeometryMaster(masterPtr->tkwin, "pack"); masterPtr->flags &= ~ALLOCED_MASTER; } } /* |
︙ | ︙ |
Changes to generic/tkRectOval.c.
︙ | ︙ | |||
755 756 757 758 759 760 761 | * will die if it isn't. */ Tk_CanvasDrawableCoords(canvas, rectOvalPtr->bbox[0],rectOvalPtr->bbox[1], &x1, &y1); Tk_CanvasDrawableCoords(canvas, rectOvalPtr->bbox[2],rectOvalPtr->bbox[3], &x2, &y2); | | | > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 856 857 858 859 860 861 862 863 864 865 | * will die if it isn't. */ Tk_CanvasDrawableCoords(canvas, rectOvalPtr->bbox[0],rectOvalPtr->bbox[1], &x1, &y1); Tk_CanvasDrawableCoords(canvas, rectOvalPtr->bbox[2],rectOvalPtr->bbox[3], &x2, &y2); if (x2 == x1) { /* * The width of the bounding box corresponds to less than one pixel * on screen. Adjustment is needed to avoid drawing attempts with zero * width items (which would draw nothing). The bounding box spans * either 1 or 2 pixels. Select which pixel will be drawn. */ short ix1 = (short) (rectOvalPtr->bbox[0]); short ix2 = (short) (rectOvalPtr->bbox[2]); if (ix1 == ix2) { /* * x1 and x2 are "within the same pixel". Use this pixel. * Note: the degenerated case (bbox[0]==bbox[2]) of a completely * flat box results in arbitrary selection of the pixel at the * right (with positive coordinate) or left (with negative * coordinate) of the box. There is no "best choice" here. */ if (ix1 > 0) { x2 += 1; } else { x1 -= 1; } } else { /* * (x1,x2) span two pixels. Select the one with the larger * covered "area". */ if (ix1 > 0) { if ((rectOvalPtr->bbox[2] - ix2) > (ix2 - rectOvalPtr->bbox[0])) { x2 += 1; } else { x1 -= 1; } } else { if ((rectOvalPtr->bbox[2] - ix1) > (ix1 - rectOvalPtr->bbox[0])) { x2 += 1; } else { x1 -= 1; } } } } if (y2 == y1) { /* * The height of the bounding box corresponds to less than one pixel * on screen. Adjustment is needed to avoid drawing attempts with zero * height items (which would draw nothing). The bounding box spans * either 1 or 2 pixels. Select which pixel will be drawn. */ short iy1 = (short) (rectOvalPtr->bbox[1]); short iy2 = (short) (rectOvalPtr->bbox[3]); if (iy1 == iy2) { /* * y1 and y2 are "within the same pixel". Use this pixel. * Note: the degenerated case (bbox[1]==bbox[3]) of a completely * flat box results in arbitrary selection of the pixel below * (with positive coordinate) or above (with negative coordinate) * the box. There is no "best choice" here. */ if (iy1 > 0) { y2 += 1; } else { y1 -= 1; } } else { /* * (y1,y2) span two pixels. Select the one with the larger * covered "area". */ if (iy1 > 0) { if ((rectOvalPtr->bbox[3] - iy2) > (iy2 - rectOvalPtr->bbox[1])) { y2 += 1; } else { y1 -= 1; } } else { if ((rectOvalPtr->bbox[3] - iy1) > (iy1 - rectOvalPtr->bbox[1])) { y2 += 1; } else { y1 -= 1; } } } } /* * Display filled part first (if wanted), then outline. If we're * stippling, then modify the stipple offset in the GC. Be sure to reset * the offset when done, since the GC is supposed to be read-only. */ |
︙ | ︙ |
Changes to generic/tkScale.c.
︙ | ︙ | |||
17 18 19 20 21 22 23 24 25 26 27 28 29 30 | * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "default.h" #include "tkInt.h" #include "tkScale.h" /* * The following table defines the legal values for the -orient option. It is * used together with the "enum orient" declaration in tkScale.h. */ static const char *const orientStrings[] = { "horizontal", "vertical", NULL | > > > > | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "default.h" #include "tkInt.h" #include "tkScale.h" #if defined(_WIN32) #define snprintf _snprintf #endif /* * The following table defines the legal values for the -orient option. It is * used together with the "enum orient" declaration in tkScale.h. */ static const char *const orientStrings[] = { "horizontal", "vertical", NULL |
︙ | ︙ | |||
673 674 675 676 677 678 679 | TCL_GLOBAL_ONLY); if ((valuePtr == NULL) || (Tcl_GetDoubleFromObj(NULL, valuePtr, &varValue) != TCL_OK)) { ScaleSetVariable(scalePtr); } else { char varString[TCL_DOUBLE_SPACE], scaleString[TCL_DOUBLE_SPACE]; | | | | | 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 | TCL_GLOBAL_ONLY); if ((valuePtr == NULL) || (Tcl_GetDoubleFromObj(NULL, valuePtr, &varValue) != TCL_OK)) { ScaleSetVariable(scalePtr); } else { char varString[TCL_DOUBLE_SPACE], scaleString[TCL_DOUBLE_SPACE]; Tcl_PrintDouble(NULL, varValue, varString); Tcl_PrintDouble(NULL, scalePtr->value, scaleString); if (strcmp(varString, scaleString)) { ScaleSetVariable(scalePtr); } } Tcl_TraceVar2(interp, Tcl_GetString(scalePtr->varNamePtr), NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, ScaleVarProc, scalePtr); } |
︙ | ︙ | |||
932 933 934 935 936 937 938 | /* * Vertical scale: compute the amount of space needed to display the * scales value by formatting strings for the two end points; use * whichever length is longer. */ | > | > > > | > > | 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 | /* * Vertical scale: compute the amount of space needed to display the * scales value by formatting strings for the two end points; use * whichever length is longer. */ if (snprintf(valueString, TCL_DOUBLE_SPACE, scalePtr->format, scalePtr->fromValue) < 0) { valueString[TCL_DOUBLE_SPACE - 1] = '\0'; } valuePixels = Tk_TextWidth(scalePtr->tkfont, valueString, -1); if (snprintf(valueString, TCL_DOUBLE_SPACE, scalePtr->format, scalePtr->toValue) < 0) { valueString[TCL_DOUBLE_SPACE - 1] = '\0'; } tmp = Tk_TextWidth(scalePtr->tkfont, valueString, -1); if (valuePixels < tmp) { valuePixels = tmp; } /* * Assign x-locations to the elements of the scale, working from left to |
︙ | ︙ | |||
1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 | int flags) /* Information about what happened. */ { register TkScale *scalePtr = clientData; const char *resultStr; double value; Tcl_Obj *valuePtr; int result; /* * If the variable is unset, then immediately recreate it unless the whole * interpreter is going away. */ if (flags & TCL_TRACE_UNSETS) { | > > > > > > > > > > > > > | 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 | int flags) /* Information about what happened. */ { register TkScale *scalePtr = clientData; const char *resultStr; double value; Tcl_Obj *valuePtr; int result; /* * See ticket [5d991b82]. */ if (scalePtr->varNamePtr == NULL) { if (!(flags & TCL_INTERP_DESTROYED)) { Tcl_UntraceVar2(interp, name1, name2, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, ScaleVarProc, clientData); } return NULL; } /* * If the variable is unset, then immediately recreate it unless the whole * interpreter is going away. */ if (flags & TCL_TRACE_UNSETS) { |
︙ | ︙ | |||
1310 1311 1312 1313 1314 1315 1316 | static void ScaleSetVariable( register TkScale *scalePtr) /* Info about widget. */ { if (scalePtr->varNamePtr != NULL) { char string[TCL_DOUBLE_SPACE]; | > | > > | 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 | static void ScaleSetVariable( register TkScale *scalePtr) /* Info about widget. */ { if (scalePtr->varNamePtr != NULL) { char string[TCL_DOUBLE_SPACE]; if (snprintf(string, TCL_DOUBLE_SPACE, scalePtr->format, scalePtr->value) < 0) { string[TCL_DOUBLE_SPACE - 1] = '\0'; } scalePtr->flags |= SETTING_VAR; Tcl_ObjSetVar2(scalePtr->interp, scalePtr->varNamePtr, NULL, Tcl_NewStringObj(string, -1), TCL_GLOBAL_ONLY); scalePtr->flags &= ~SETTING_VAR; } } |
︙ | ︙ |
Changes to generic/tkText.c.
︙ | ︙ | |||
2074 2075 2076 2077 2078 2079 2080 | Tcl_Interp *interp, /* Used for error reporting. */ register TkText *textPtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_SavedOptions savedOptions; | | | 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 | Tcl_Interp *interp, /* Used for error reporting. */ register TkText *textPtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_SavedOptions savedOptions; int oldExport = (textPtr->exportSelection) && (!Tcl_IsSafe(textPtr->interp)); int mask = 0; if (Tk_SetOptions(interp, (char *) textPtr, textPtr->optionTable, objc, objv, textPtr->tkwin, &savedOptions, &mask) != TCL_OK) { return TCL_ERROR; } |
︙ | ︙ | |||
2303 2304 2305 2306 2307 2308 2309 | TkTextRedrawTag(NULL, textPtr, NULL, NULL, textPtr->selTagPtr, 1); /* * Claim the selection if we've suddenly started exporting it and there * are tagged characters. */ | | | 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 | TkTextRedrawTag(NULL, textPtr, NULL, NULL, textPtr->selTagPtr, 1); /* * Claim the selection if we've suddenly started exporting it and there * are tagged characters. */ if (textPtr->exportSelection && (!oldExport) && (!Tcl_IsSafe(textPtr->interp))) { TkTextSearch search; TkTextIndex first, last; TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr, 0, 0, &first); TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr, TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr), |
︙ | ︙ | |||
2722 2723 2724 2725 2726 2727 2728 | resetViewCount += 2; } if (sharedTextPtr->refCount > PIXEL_CLIENTS) { ckfree(lineAndByteIndex); } /* | | > > > > | 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 | resetViewCount += 2; } if (sharedTextPtr->refCount > PIXEL_CLIENTS) { ckfree(lineAndByteIndex); } /* * Invalidate any selection retrievals in progress, and send an event * that the selection changed if that is the case. */ for (tPtr = sharedTextPtr->peers; tPtr != NULL ; tPtr = tPtr->next) { if (TkBTreeCharTagged(indexPtr, tPtr->selTagPtr)) { TkTextSelectionEvent(tPtr); } tPtr->abortSelections = 1; } /* * For convenience, return the length of the string. */ |
︙ | ︙ | |||
3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 | { int line1, line2; TkTextIndex index1, index2; TkText *tPtr; int *lineAndByteIndex; int resetViewCount; int pixels[2*PIXEL_CLIENTS]; if (sharedTextPtr == NULL) { sharedTextPtr = textPtr->sharedTextPtr; } /* * Prepare the starting and stopping indices. | > > > | 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 | { int line1, line2; TkTextIndex index1, index2; TkText *tPtr; int *lineAndByteIndex; int resetViewCount; int pixels[2*PIXEL_CLIENTS]; Tcl_HashSearch search; Tcl_HashEntry *hPtr; int i; if (sharedTextPtr == NULL) { sharedTextPtr = textPtr->sharedTextPtr; } /* * Prepare the starting and stopping indices. |
︙ | ︙ | |||
3129 3130 3131 3132 3133 3134 3135 | for (i = 0; i < arraySize; i++) { TkBTreeTag(&index2, &oldIndex2, arrayPtr[i], 0); } ckfree(arrayPtr); } } | < | | | | | < < < < | | | | | | | | | | | | | | | | | | | | < | 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 | for (i = 0; i < arraySize; i++) { TkBTreeTag(&index2, &oldIndex2, arrayPtr[i], 0); } ckfree(arrayPtr); } } /* * For speed, we remove all tags from the range first. If we don't * do this, the code below can (when there are many tags) grow * non-linearly in execution time. */ for (i=0, hPtr=Tcl_FirstHashEntry(&sharedTextPtr->tagTable, &search); hPtr != NULL; i++, hPtr = Tcl_NextHashEntry(&search)) { TkTextTag *tagPtr = Tcl_GetHashValue(hPtr); TkBTreeTag(&index1, &index2, tagPtr, 0); } /* * Special case for the sel tag which is not in the hash table. We * need to do this once for each peer text widget. */ for (tPtr = sharedTextPtr->peers; tPtr != NULL ; tPtr = tPtr->next) { if (TkBTreeTag(&index1, &index2, tPtr->selTagPtr, 0)) { /* * Send an event that the selection changed. This is * equivalent to: * event generate $textWidget <<Selection>> */ TkTextSelectionEvent(textPtr); tPtr->abortSelections = 1; } } /* * Tell the display what's about to happen so it can discard obsolete * display information, then do the deletion. Also, if the deletion * involves the top line on the screen, then we have to reset the view * (the deletion will invalidate textPtr->topIndex). Compute what the new |
︙ | ︙ | |||
3374 3375 3376 3377 3378 3379 3380 | { register TkText *textPtr = clientData; TkTextIndex eof; int count, chunkSize, offsetInSeg; TkTextSearch search; TkTextSegment *segPtr; | | | 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 | { register TkText *textPtr = clientData; TkTextIndex eof; int count, chunkSize, offsetInSeg; TkTextSearch search; TkTextSegment *segPtr; if ((!textPtr->exportSelection) || Tcl_IsSafe(textPtr->interp)) { return -1; } /* * Find the beginning of the next range of selected text. Note: if the * selection is being retrieved in multiple pieces (offset != 0) and some * modification has been made to the text that affects the selection then |
︙ | ︙ | |||
3504 3505 3506 3507 3508 3509 3510 | ClientData clientData) /* Information about text widget. */ { register TkText *textPtr = clientData; if (TkpAlwaysShowSelection(textPtr->tkwin)) { TkTextIndex start, end; | | | 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 | ClientData clientData) /* Information about text widget. */ { register TkText *textPtr = clientData; if (TkpAlwaysShowSelection(textPtr->tkwin)) { TkTextIndex start, end; if ((!textPtr->exportSelection) || Tcl_IsSafe(textPtr->interp)) { return; } /* * On Windows and Mac systems, we want to remember the selection for * the next time the focus enters the window. On Unix, just remove the * "sel" tag from everything in the widget. |
︙ | ︙ | |||
3751 3752 3753 3754 3755 3756 3757 | static const char *const switchStrings[] = { "-hidden", "--", "-all", "-backwards", "-count", "-elide", "-exact", "-forwards", "-nocase", "-nolinestop", "-overlap", "-regexp", "-strictlimits", NULL }; enum SearchSwitches { | | | | | | 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 | static const char *const switchStrings[] = { "-hidden", "--", "-all", "-backwards", "-count", "-elide", "-exact", "-forwards", "-nocase", "-nolinestop", "-overlap", "-regexp", "-strictlimits", NULL }; enum SearchSwitches { TK_TEXT_SEARCH_HIDDEN, TK_TEXT_SEARCH_END, TK_TEXT_SEARCH_ALL, TK_TEXT_SEARCH_BACK, TK_TEXT_SEARCH_COUNT, TK_TEXT_SEARCH_ELIDE, TK_TEXT_SEARCH_EXACT, TK_TEXT_SEARCH_FWD, TK_TEXT_SEARCH_NOCASE, TK_TEXT_SEARCH_NOLINESTOP, TK_TEXT_SEARCH_OVERLAP, TK_TEXT_SEARCH_REGEXP, TK_TEXT_SEARCH_STRICTLIMITS }; /* * Set up the search specification, including the last 4 fields which are * text widget specific. */ |
︙ | ︙ | |||
3804 3805 3806 3807 3808 3809 3810 | (void) Tcl_GetIndexFromObjStruct(interp, objv[i], switchStrings+1, sizeof(char *), "switch", 0, &index); return TCL_ERROR; } switch ((enum SearchSwitches) index) { | | | | | | | | | | | | | | | 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 | (void) Tcl_GetIndexFromObjStruct(interp, objv[i], switchStrings+1, sizeof(char *), "switch", 0, &index); return TCL_ERROR; } switch ((enum SearchSwitches) index) { case TK_TEXT_SEARCH_END: i++; goto endOfSwitchProcessing; case TK_TEXT_SEARCH_ALL: searchSpec.all = 1; break; case TK_TEXT_SEARCH_BACK: searchSpec.backwards = 1; break; case TK_TEXT_SEARCH_COUNT: if (i >= objc-1) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "no value given for \"-count\" option", -1)); Tcl_SetErrorCode(interp, "TK", "TEXT", "VALUE", NULL); return TCL_ERROR; } i++; /* * Assumption objv[i] isn't going to disappear on us during this * function, which is fair. */ searchSpec.varPtr = objv[i]; break; case TK_TEXT_SEARCH_ELIDE: case TK_TEXT_SEARCH_HIDDEN: searchSpec.searchElide = 1; break; case TK_TEXT_SEARCH_EXACT: searchSpec.exact = 1; break; case TK_TEXT_SEARCH_FWD: searchSpec.backwards = 0; break; case TK_TEXT_SEARCH_NOCASE: searchSpec.noCase = 1; break; case TK_TEXT_SEARCH_NOLINESTOP: searchSpec.noLineStop = 1; break; case TK_TEXT_SEARCH_OVERLAP: searchSpec.overlap = 1; break; case TK_TEXT_SEARCH_STRICTLIMITS: searchSpec.strictLimits = 1; break; case TK_TEXT_SEARCH_REGEXP: searchSpec.exact = 0; break; default: Tcl_Panic("unexpected switch fallthrough"); } } endOfSwitchProcessing: |
︙ | ︙ |
Changes to generic/tkTextDisp.c.
︙ | ︙ | |||
4116 4117 4118 4119 4120 4121 4122 | * If drawing is disabled, all we need to do is * clear the REDRAW_PENDING flag. */ TkWindow *winPtr = (TkWindow *)(textPtr->tkwin); MacDrawable *macWin = winPtr->privatePtr; if (macWin && (macWin->flags & TK_DO_NOT_DRAW)){ dInfoPtr->flags &= ~REDRAW_PENDING; | | | | 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 | * If drawing is disabled, all we need to do is * clear the REDRAW_PENDING flag. */ TkWindow *winPtr = (TkWindow *)(textPtr->tkwin); MacDrawable *macWin = winPtr->privatePtr; if (macWin && (macWin->flags & TK_DO_NOT_DRAW)){ dInfoPtr->flags &= ~REDRAW_PENDING; return; } #endif if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)) { /* * The widget has been deleted. Don't do anything. */ |
︙ | ︙ | |||
4270 4271 4272 4273 4274 4275 4276 | dlPtr->oldY = dlPtr->y; if (dlPtr->nextPtr == dlPtr2) { break; } dlPtr = dlPtr->nextPtr; } | < | 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 | dlPtr->oldY = dlPtr->y; if (dlPtr->nextPtr == dlPtr2) { break; } dlPtr = dlPtr->nextPtr; } /* * Scan through the lines following the copied ones to see if we are * going to overwrite them with the copy operation. If so, mark them * for redisplay. */ for ( ; dlPtr2 != NULL; dlPtr2 = dlPtr2->nextPtr) { |
︙ | ︙ | |||
4294 4295 4296 4297 4298 4299 4300 | * calling TextInvalidateRegion to mark the display blocks as stale. */ damageRgn = TkCreateRegion(); if (TkScrollWindow(textPtr->tkwin, dInfoPtr->scrollGC, dInfoPtr->x, oldY, dInfoPtr->maxX-dInfoPtr->x, height, 0, y-oldY, damageRgn)) { | < < | 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 | * calling TextInvalidateRegion to mark the display blocks as stale. */ damageRgn = TkCreateRegion(); if (TkScrollWindow(textPtr->tkwin, dInfoPtr->scrollGC, dInfoPtr->x, oldY, dInfoPtr->maxX-dInfoPtr->x, height, 0, y-oldY, damageRgn)) { TextInvalidateRegion(textPtr, damageRgn); } numCopies++; TkDestroyRegion(damageRgn); } /* * Clear the REDRAW_PENDING flag here. This is actually pretty tricky. We |
︙ | ︙ | |||
4438 4439 4440 4441 4442 4443 4444 4445 4446 | #ifndef TK_NO_DOUBLE_BUFFERING Tk_FreePixmap(Tk_Display(textPtr->tkwin), pixmap); #endif /* TK_NO_DOUBLE_BUFFERING */ return; } dlPtr->oldY = dlPtr->y; dlPtr->flags &= ~(NEW_LAYOUT | OLD_Y_INVALID); } else if (dlPtr->chunkPtr != NULL && ((dlPtr->y < 0) || (dlPtr->y + dlPtr->height > dInfoPtr->maxY))) { | > > > > > > > > > > > > > > > > > > > > > > > > > > > < < > > > > | 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 | #ifndef TK_NO_DOUBLE_BUFFERING Tk_FreePixmap(Tk_Display(textPtr->tkwin), pixmap); #endif /* TK_NO_DOUBLE_BUFFERING */ return; } dlPtr->oldY = dlPtr->y; dlPtr->flags &= ~(NEW_LAYOUT | OLD_Y_INVALID); #ifdef MAC_OSX_TK } else if (dlPtr->chunkPtr != NULL) { /* * On macOS we need to redisplay all embedded windows which * were moved by the call to TkScrollWindows above. This is * not necessary on Unix or Windows because XScrollWindow will * have included the bounding rectangles of all of these * windows in the damage region. The macosx implementation of * TkScrollWindow does not do this. It simply generates a * damage region which is the scroll source rectangle minus * the scroll destination rectangle. This is because there is * no efficient process available for iterating through the * subwindows which meet the scrolled area. (On Unix this is * handled by GraphicsExpose events generated by XCopyArea and * on Windows by ScrollWindowEx. On macOS the low level * scrolling is accomplished by calling [view scrollRect:by:]. * This method does not provide any damage information and, in * any case, could not be aware of Tk windows which were not * based on NSView objects. * * On the other hand, this loop is already iterating through * all embedded windows which could possibly have been moved * by the scrolling. So it is as efficient to redisplay them * here as it would have been if they had been redisplayed by * the call to TextInvalidateRegion above. */ #else } else if (dlPtr->chunkPtr != NULL && ((dlPtr->y < 0) || (dlPtr->y + dlPtr->height > dInfoPtr->maxY))) { /* * On platforms other than the Mac: * * It's the first or last DLine which are also overlapping the * top or bottom of the window, but we decided above it wasn't * necessary to display them (we were able to update them by * scrolling). This is fine, except that if the lines contain * any embedded windows, we must still call the display proc * on them because they might need to be unmapped or they * might need to be moved to reflect their new position. * Otherwise, everything else moves, but the embedded window * doesn't! * * So, we loop through all the chunks, calling the display * proc of embedded windows only. */ #endif register TkTextDispChunk *chunkPtr; for (chunkPtr = dlPtr->chunkPtr; (chunkPtr != NULL); chunkPtr = chunkPtr->nextPtr) { int x; if (chunkPtr->displayProc != TkTextEmbWinDisplayProc) { continue; } |
︙ | ︙ | |||
4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 | * as being off-screen to the left (the displayProc * may not be able to tell if something is off to the * right). */ x = -chunkPtr->width; } TkTextEmbWinDisplayProc(textPtr, chunkPtr, x, dlPtr->spaceAbove, dlPtr->height-dlPtr->spaceAbove-dlPtr->spaceBelow, dlPtr->baseline - dlPtr->spaceAbove, NULL, (Drawable) None, dlPtr->y + dlPtr->spaceAbove); } | > > > > > > < | 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 | * as being off-screen to the left (the displayProc * may not be able to tell if something is off to the * right). */ x = -chunkPtr->width; } if (tkTextDebug) { char string[TK_POS_CHARS]; TkTextPrintIndex(textPtr, &dlPtr->index, string); LOG("tk_textEmbWinDisplay", string); } TkTextEmbWinDisplayProc(textPtr, chunkPtr, x, dlPtr->spaceAbove, dlPtr->height-dlPtr->spaceAbove-dlPtr->spaceBelow, dlPtr->baseline - dlPtr->spaceAbove, NULL, (Drawable) None, dlPtr->y + dlPtr->spaceAbove); } } } #ifndef TK_NO_DOUBLE_BUFFERING Tk_FreePixmap(Tk_Display(textPtr->tkwin), pixmap); #endif /* TK_NO_DOUBLE_BUFFERING */ } |
︙ | ︙ |
Changes to generic/tkTextTag.c.
︙ | ︙ | |||
239 240 241 242 243 244 245 246 247 248 249 250 251 252 | * equivalent to: * event generate $textWidget <<Selection>> */ TkTextSelectionEvent(textPtr); if (addTag && textPtr->exportSelection && !(textPtr->flags & GOT_SELECTION)) { Tk_OwnSelection(textPtr->tkwin, XA_PRIMARY, TkTextLostSelection, textPtr); textPtr->flags |= GOT_SELECTION; } textPtr->abortSelections = 1; } | > | 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | * equivalent to: * event generate $textWidget <<Selection>> */ TkTextSelectionEvent(textPtr); if (addTag && textPtr->exportSelection && (!Tcl_IsSafe(textPtr->interp)) && !(textPtr->flags & GOT_SELECTION)) { Tk_OwnSelection(textPtr->tkwin, XA_PRIMARY, TkTextLostSelection, textPtr); textPtr->flags |= GOT_SELECTION; } textPtr->abortSelections = 1; } |
︙ | ︙ |
Changes to generic/ttk/ttkButton.c.
︙ | ︙ | |||
485 486 487 488 489 490 491 | BaseCleanup(recordPtr); } static int CheckbuttonConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { Checkbutton *checkPtr = recordPtr; | > | | > > | < | | > > | > | 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 | BaseCleanup(recordPtr); } static int CheckbuttonConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { Checkbutton *checkPtr = recordPtr; Tcl_Obj *varName = checkPtr->checkbutton.variableObj; Ttk_TraceHandle *vt = NULL; if (varName != NULL && *Tcl_GetString(varName) != '\0') { vt = Ttk_TraceVariable(interp, varName, CheckbuttonVariableChanged, checkPtr); if (!vt) { return TCL_ERROR; } } if (BaseConfigure(interp, recordPtr, mask) != TCL_OK){ Ttk_UntraceVariable(vt); return TCL_ERROR; } if (checkPtr->checkbutton.variableTrace) { Ttk_UntraceVariable(checkPtr->checkbutton.variableTrace); } checkPtr->checkbutton.variableTrace = vt; return TCL_OK; } static int CheckbuttonPostConfigure(Tcl_Interp *interp, void *recordPtr, int mask) |
︙ | ︙ | |||
544 545 546 547 548 549 550 | * Toggle the selected state. */ if (corePtr->state & TTK_STATE_SELECTED) newValue = checkPtr->checkbutton.offValueObj; else newValue = checkPtr->checkbutton.onValueObj; | > > > | | | | | 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 | * Toggle the selected state. */ if (corePtr->state & TTK_STATE_SELECTED) newValue = checkPtr->checkbutton.offValueObj; else newValue = checkPtr->checkbutton.onValueObj; if (checkPtr->checkbutton.variableObj == NULL || *Tcl_GetString(checkPtr->checkbutton.variableObj) == '\0') CheckbuttonVariableChanged(checkPtr, Tcl_GetString(newValue)); else if (Tcl_ObjSetVar2(interp, checkPtr->checkbutton.variableObj, NULL, newValue, TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG) == NULL) return TCL_ERROR; if (WidgetDestroyed(corePtr)) return TCL_ERROR; return Tcl_EvalObjEx(interp, checkPtr->checkbutton.commandObj, TCL_EVAL_GLOBAL); |
︙ | ︙ |
Changes to generic/ttk/ttkEntry.c.
︙ | ︙ | |||
333 334 335 336 337 338 339 | ClientData clientData, int offset, char *buffer, int maxBytes) { Entry *entryPtr = (Entry *) clientData; size_t byteCount; const char *string; const char *selStart, *selEnd; | | > | 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 | ClientData clientData, int offset, char *buffer, int maxBytes) { Entry *entryPtr = (Entry *) clientData; size_t byteCount; const char *string; const char *selStart, *selEnd; if (entryPtr->entry.selectFirst < 0 || (!entryPtr->entry.exportSelection) || Tcl_IsSafe(entryPtr->core.interp)) { return -1; } string = entryPtr->entry.displayString; selStart = Tcl_UtfAtIndex(string, entryPtr->entry.selectFirst); selEnd = Tcl_UtfAtIndex(selStart, entryPtr->entry.selectLast - entryPtr->entry.selectFirst); |
︙ | ︙ | |||
368 369 370 371 372 373 374 | entryPtr->core.flags &= ~GOT_SELECTION; entryPtr->entry.selectFirst = entryPtr->entry.selectLast = -1; TtkRedisplayWidget(&entryPtr->core); } /* EntryOwnSelection -- * Assert ownership of the PRIMARY selection, | | > | 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | entryPtr->core.flags &= ~GOT_SELECTION; entryPtr->entry.selectFirst = entryPtr->entry.selectLast = -1; TtkRedisplayWidget(&entryPtr->core); } /* EntryOwnSelection -- * Assert ownership of the PRIMARY selection, * if -exportselection set and selection is present and interp is unsafe. */ static void EntryOwnSelection(Entry *entryPtr) { if (entryPtr->entry.exportSelection && (!Tcl_IsSafe(entryPtr->core.interp)) && !(entryPtr->core.flags & GOT_SELECTION)) { Tk_OwnSelection(entryPtr->core.tkwin, XA_PRIMARY, EntryLostSelection, (ClientData) entryPtr); entryPtr->core.flags |= GOT_SELECTION; } } |
︙ | ︙ | |||
995 996 997 998 999 1000 1001 | if (entryPtr->entry.textVariableTrace) Ttk_UntraceVariable(entryPtr->entry.textVariableTrace); entryPtr->entry.textVariableTrace = vt; } /* Claim the selection, in case we've suddenly started exporting it. */ | | > | 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 | if (entryPtr->entry.textVariableTrace) Ttk_UntraceVariable(entryPtr->entry.textVariableTrace); entryPtr->entry.textVariableTrace = vt; } /* Claim the selection, in case we've suddenly started exporting it. */ if (entryPtr->entry.exportSelection && (entryPtr->entry.selectFirst != -1) && (!Tcl_IsSafe(entryPtr->core.interp))) { EntryOwnSelection(entryPtr); } /* Handle -state compatibility option: */ if (mask & STATE_CHANGED) { TtkCheckStateOption(&entryPtr->core, entryPtr->entry.stateObj); |
︙ | ︙ |
Changes to generic/ttk/ttkProgress.c.
︙ | ︙ | |||
417 418 419 420 421 422 423 424 425 426 427 428 429 | if (pb->progress.mode == TTK_PROGRESSBAR_DETERMINATE) { double maximum = 100.0; (void)Tcl_GetDoubleFromObj(NULL, pb->progress.maximumObj, &maximum); value = fmod(value, maximum); } newValueObj = Tcl_NewDoubleObj(value); TtkRedisplayWidget(&pb->core); /* Update value by setting the linked -variable, if there is one: */ if (pb->progress.variableTrace) { | > | | | | > > < | 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 | if (pb->progress.mode == TTK_PROGRESSBAR_DETERMINATE) { double maximum = 100.0; (void)Tcl_GetDoubleFromObj(NULL, pb->progress.maximumObj, &maximum); value = fmod(value, maximum); } newValueObj = Tcl_NewDoubleObj(value); Tcl_IncrRefCount(newValueObj); TtkRedisplayWidget(&pb->core); /* Update value by setting the linked -variable, if there is one: */ if (pb->progress.variableTrace) { int result = Tcl_ObjSetVar2( interp, pb->progress.variableObj, 0, newValueObj, TCL_GLOBAL_ONLY | TCL_LEAVE_ERR_MSG) ? TCL_OK : TCL_ERROR; Tcl_DecrRefCount(newValueObj); return result; } /* Otherwise, change the -value directly: */ Tcl_DecrRefCount(pb->progress.valueObj); pb->progress.valueObj = newValueObj; CheckAnimation(pb); return TCL_OK; } |
︙ | ︙ |
Changes to generic/ttk/ttkScale.c.
︙ | ︙ | |||
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 | #include "ttkWidget.h" #define DEF_SCALE_LENGTH "100" #define MAX(a,b) ((a) > (b) ? (a) : (b)) #define MIN(a,b) ((a) < (b) ? (a) : (b)) /* * Scale widget record */ typedef struct { /* slider element options */ Tcl_Obj *fromObj; /* minimum value */ Tcl_Obj *toObj; /* maximum value */ Tcl_Obj *valueObj; /* current value */ Tcl_Obj *lengthObj; /* length of the long axis of the scale */ Tcl_Obj *orientObj; /* widget orientation */ int orient; /* widget options */ Tcl_Obj *commandObj; Tcl_Obj *variableObj; /* internal state */ Ttk_TraceHandle *variableTrace; } ScalePart; typedef struct { WidgetCore core; ScalePart scale; } Scale; | > > > > > > > > > | 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 | #include "ttkWidget.h" #define DEF_SCALE_LENGTH "100" #define MAX(a,b) ((a) > (b) ? (a) : (b)) #define MIN(a,b) ((a) < (b) ? (a) : (b)) /* Bit fields for OptionSpec mask field: */ #define STATE_CHANGED (0x100) /* -state option changed */ /* * Scale widget record */ typedef struct { /* slider element options */ Tcl_Obj *fromObj; /* minimum value */ Tcl_Obj *toObj; /* maximum value */ Tcl_Obj *valueObj; /* current value */ Tcl_Obj *lengthObj; /* length of the long axis of the scale */ Tcl_Obj *orientObj; /* widget orientation */ int orient; /* widget options */ Tcl_Obj *commandObj; Tcl_Obj *variableObj; /* internal state */ Ttk_TraceHandle *variableTrace; /* * Compatibility/legacy options: */ Tcl_Obj *stateObj; } ScalePart; typedef struct { WidgetCore core; ScalePart scale; } Scale; |
︙ | ︙ | |||
61 62 63 64 65 66 67 68 69 70 71 72 73 74 | {TK_OPTION_DOUBLE, "-to", "to", "To", "1.0", Tk_Offset(Scale,scale.toObj), -1, 0, 0, 0}, {TK_OPTION_DOUBLE, "-value", "value", "Value", "0", Tk_Offset(Scale,scale.valueObj), -1, 0, 0, 0}, {TK_OPTION_PIXELS, "-length", "length", "Length", DEF_SCALE_LENGTH, Tk_Offset(Scale,scale.lengthObj), -1, 0, 0, GEOMETRY_CHANGED}, WIDGET_TAKEFOCUS_TRUE, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; static XPoint ValueToPoint(Scale *scalePtr, double value); static double PointToValue(Scale *scalePtr, int x, int y); | > > > > | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | {TK_OPTION_DOUBLE, "-to", "to", "To", "1.0", Tk_Offset(Scale,scale.toObj), -1, 0, 0, 0}, {TK_OPTION_DOUBLE, "-value", "value", "Value", "0", Tk_Offset(Scale,scale.valueObj), -1, 0, 0, 0}, {TK_OPTION_PIXELS, "-length", "length", "Length", DEF_SCALE_LENGTH, Tk_Offset(Scale,scale.lengthObj), -1, 0, 0, GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-state", "state", "State", "normal", Tk_Offset(Scale,scale.stateObj), -1, 0,0,STATE_CHANGED}, WIDGET_TAKEFOCUS_TRUE, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; static XPoint ValueToPoint(Scale *scalePtr, double value); static double PointToValue(Scale *scalePtr, int x, int y); |
︙ | ︙ | |||
134 135 136 137 138 139 140 141 142 143 144 145 146 147 | return TCL_ERROR; } if (scale->scale.variableTrace) { Ttk_UntraceVariable(scale->scale.variableTrace); } scale->scale.variableTrace = vt; return TCL_OK; } /* ScalePostConfigure -- * Post-configuration hook. */ | > > > > | 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | return TCL_ERROR; } if (scale->scale.variableTrace) { Ttk_UntraceVariable(scale->scale.variableTrace); } scale->scale.variableTrace = vt; if (mask & STATE_CHANGED) { TtkCheckStateOption(&scale->core, scale->scale.stateObj); } return TCL_OK; } /* ScalePostConfigure -- * Post-configuration hook. */ |
︙ | ︙ |
Changes to generic/ttk/ttkTrace.c.
︙ | ︙ | |||
22 23 24 25 26 27 28 | /* * Tcl_VarTraceProc for trace handles. */ static char * VarTraceProc( ClientData clientData, /* Widget record pointer */ Tcl_Interp *interp, /* Interpreter containing variable. */ | | | > > > > > > > > > > > | 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 | /* * Tcl_VarTraceProc for trace handles. */ static char * VarTraceProc( ClientData clientData, /* Widget record pointer */ Tcl_Interp *interp, /* Interpreter containing variable. */ const char *name1, /* Name of variable. */ const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { Ttk_TraceHandle *tracePtr = clientData; const char *name, *value; Tcl_Obj *valuePtr; if (flags & TCL_INTERP_DESTROYED) { return NULL; } /* * See ticket [5d991b82]. */ if (tracePtr->varnameObj == NULL) { Tcl_UntraceVar2(interp, name1, name2, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, VarTraceProc, clientData); return NULL; } name = Tcl_GetString(tracePtr->varnameObj); /* * If the variable is being unset, then re-establish the trace: */ if (flags & TCL_TRACE_DESTROYED) { |
︙ | ︙ |
Added library/demos/images/earthmenu.png.
cannot compute difference between binary files
Changes to library/demos/menu.tcl.
︙ | ︙ | |||
110 111 112 113 114 115 116 | $m invoke 1 $m invoke 7 set m $w.menu.icon $w.menu add cascade -label "Icons" -menu $m -underline 0 menu $m -tearoff 0 # Main widget program sets variable tk_demoDirectory | | > > | | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | $m invoke 1 $m invoke 7 set m $w.menu.icon $w.menu add cascade -label "Icons" -menu $m -underline 0 menu $m -tearoff 0 # Main widget program sets variable tk_demoDirectory image create photo lilearth -file [file join $tk_demoDirectory \ images earthmenu.png] $m add command -image lilearth \ -hidemargin 1 -command [list \ tk_dialog $w.pattern {Bitmap Menu Entry} \ "The menu entry you invoked displays a photoimage rather than\ a text string. Other than this, it is just like any other\ menu entry." {} 0 OK ] foreach i {info questhead error} { $m add command -bitmap $i -hidemargin 1 -command [list \ puts "You invoked the $i bitmap" ] } $m entryconfigure 2 -columnbreak 1 |
︙ | ︙ |
Changes to library/demos/twind.tcl.
︙ | ︙ | |||
79 80 81 82 83 84 85 | $t insert end "You can also create multiple text widgets each of which " $t insert end "display the same underlying text. Click this button to " $t window create end \ -create {button %W.peer -text "Make A Peer" -command "textMakePeer %W" \ -cursor top_left_arrow} -padx 3 $t insert end " widget. Notice how peer widgets can have different " $t insert end "font settings, and by default contain all the images " | | | | | | | | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | $t insert end "You can also create multiple text widgets each of which " $t insert end "display the same underlying text. Click this button to " $t window create end \ -create {button %W.peer -text "Make A Peer" -command "textMakePeer %W" \ -cursor top_left_arrow} -padx 3 $t insert end " widget. Notice how peer widgets can have different " $t insert end "font settings, and by default contain all the images " $t insert end "of the 'parent', but that the embedded windows, " $t insert end "such as buttons may not appear in the peer. To ensure " $t insert end "that embedded windows appear in all peers you can set the " $t insert end "'-create' option to a script or a string containing %W. " $t insert end "(The plot above and the 'Make A Peer' button are " $t insert end "designed to show up in all peers.) A good use of " $t insert end "peers is for " $t window create end \ -create {button %W.split -text "Split Windows" -command "textSplitWindow %W" \ -cursor top_left_arrow} -padx 3 $t insert end " \n\n" $t insert end "Users of previous versions of Tk will also be interested " |
︙ | ︙ | |||
108 109 110 111 112 113 114 115 116 117 118 119 120 121 | $t insert end "text widget (\"Default\" restores the color to " $t insert end "its default). If you click on the button labeled " $t insert end "\"Short\", it changes to a longer string so that " $t insert end "you can see how the text widget automatically " $t insert end "changes the layout. Click on the button again " $t insert end "to restore the short string.\n" button $t.default -text Default -command "embDefBg $t" \ -cursor top_left_arrow $t window create end -window $t.default -padx 3 global embToggle set embToggle Short checkbutton $t.toggle -textvariable embToggle -indicatoron 0 \ -variable embToggle -onvalue "A much longer string" \ | > | 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | $t insert end "text widget (\"Default\" restores the color to " $t insert end "its default). If you click on the button labeled " $t insert end "\"Short\", it changes to a longer string so that " $t insert end "you can see how the text widget automatically " $t insert end "changes the layout. Click on the button again " $t insert end "to restore the short string.\n" $t insert end "\nNOTE: these buttons will not appear in peers!\n" "peer_warning" button $t.default -text Default -command "embDefBg $t" \ -cursor top_left_arrow $t window create end -window $t.default -padx 3 global embToggle set embToggle Short checkbutton $t.toggle -textvariable embToggle -indicatoron 0 \ -variable embToggle -onvalue "A much longer string" \ |
︙ | ︙ | |||
159 160 161 162 163 164 165 | $t window create end -window $t.bigP $t window create end -window $t.smallP $t insert end "\n\nFinally, images fit comfortably in text widgets too:" $t image create end -image \ [image create photo -file [file join $tk_demoDirectory images ouster.png]] | < | 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | $t window create end -window $t.bigP $t window create end -window $t.smallP $t insert end "\n\nFinally, images fit comfortably in text widgets too:" $t image create end -image \ [image create photo -file [file join $tk_demoDirectory images ouster.png]] proc textWindBigB w { $w configure -borderwidth 15 } proc textWindBigH w { $w configure -highlightthickness 15 |
︙ | ︙ | |||
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 | set n 1 while {[winfo exists .peer$n]} { incr n } set w [toplevel .peer$n] wm title $w "Text Peer #$n" frame $w.f -highlightthickness 1 -borderwidth 1 -relief sunken set t [$parent peer create $w.f.text -yscrollcommand "$w.scroll set" \ -borderwidth 0 -highlightthickness 0] pack $t -expand yes -fill both ttk::scrollbar $w.scroll -command "$t yview" pack $w.scroll -side right -fill y pack $w.f -expand yes -fill both } proc textSplitWindow {textW} { if {$textW eq ".twind.f.text"} { if {[winfo exists .twind.peer]} { destroy .twind.peer } else { set parent [winfo parent $textW] set w [winfo parent $parent] set t [$textW peer create $w.peer \ -yscrollcommand "$w.scroll set"] $w.pane add $t } } else { return } } | > > | 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 | set n 1 while {[winfo exists .peer$n]} { incr n } set w [toplevel .peer$n] wm title $w "Text Peer #$n" frame $w.f -highlightthickness 1 -borderwidth 1 -relief sunken set t [$parent peer create $w.f.text -yscrollcommand "$w.scroll set" \ -borderwidth 0 -highlightthickness 0] $t tag configure peer_warning -font boldFont pack $t -expand yes -fill both ttk::scrollbar $w.scroll -command "$t yview" pack $w.scroll -side right -fill y pack $w.f -expand yes -fill both } proc textSplitWindow {textW} { if {$textW eq ".twind.f.text"} { if {[winfo exists .twind.peer]} { destroy .twind.peer } else { set parent [winfo parent $textW] set w [winfo parent $parent] set t [$textW peer create $w.peer \ -yscrollcommand "$w.scroll set"] $t tag configure peer_warning -font boldFont $w.pane add $t } } else { return } } |
Changes to library/fontchooser.tcl.
︙ | ︙ | |||
61 62 63 64 65 66 67 68 69 70 71 72 73 74 | proc ::tk::fontchooser::Show {} { variable S if {![winfo exists $S(W)]} { Create wm transient $S(W) [winfo toplevel $S(-parent)] tk::PlaceWindow $S(W) widget $S(-parent) } wm deiconify $S(W) } proc ::tk::fontchooser::Hide {} { variable S wm withdraw $S(W) } | > > > | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | proc ::tk::fontchooser::Show {} { variable S if {![winfo exists $S(W)]} { Create wm transient $S(W) [winfo toplevel $S(-parent)] tk::PlaceWindow $S(W) widget $S(-parent) } set S(fonts) [lsort -dictionary [font families]] set S(fonts,lcase) {} foreach font $S(fonts) { lappend S(fonts,lcase) [string tolower $font]} wm deiconify $S(W) } proc ::tk::fontchooser::Hide {} { variable S wm withdraw $S(W) } |
︙ | ︙ |
Changes to library/text.tcl.
︙ | ︙ | |||
764 765 766 767 768 769 770 771 772 773 774 775 776 777 | if {[$w compare $new < insert]} { $w tag add sel $new insert } else { $w tag add sel insert $new } $w mark set $anchorname insert } else { if {[$w compare $new < $anchorname]} { set first $new set last $anchorname } else { set first $anchorname set last $new } | > > > | 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 | if {[$w compare $new < insert]} { $w tag add sel $new insert } else { $w tag add sel insert $new } $w mark set $anchorname insert } else { if {[catch {$w index $anchorname}]} { $w mark set $anchorname insert } if {[$w compare $new < $anchorname]} { set first $new set last $anchorname } else { set first $anchorname set last $new } |
︙ | ︙ | |||
1051 1052 1053 1054 1055 1056 1057 | # w - Name of a text widget. proc ::tk_textCut w { if {![catch {set data [$w get sel.first sel.last]}]} { # make <<Cut>> an atomic operation on the Undo stack, # i.e. separate it from other delete operations on either side set oldSeparator [$w cget -autoseparators] | | | | 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 | # w - Name of a text widget. proc ::tk_textCut w { if {![catch {set data [$w get sel.first sel.last]}]} { # make <<Cut>> an atomic operation on the Undo stack, # i.e. separate it from other delete operations on either side set oldSeparator [$w cget -autoseparators] if {([$w cget -state] eq "normal") && $oldSeparator} { $w edit separator } clipboard clear -displayof $w clipboard append -displayof $w $data $w delete sel.first sel.last if {([$w cget -state] eq "normal") && $oldSeparator} { $w edit separator } } } # ::tk_textPaste -- # This procedure pastes the contents of the clipboard to the insertion |
︙ | ︙ |
Changes to library/tk.tcl.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # tk.tcl -- # # Initialization script normally executed in the interpreter for each Tk-based # application. Arranges class bindings for widgets. # # Copyright (c) 1992-1994 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. # Copyright (c) 1998-2000 Ajuba Solutions. # # See the file "license.terms" for information on usage and redistribution of # this file, and for a DISCLAIMER OF ALL WARRANTIES. # Verify that we have Tk binary and script components from the same release | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # tk.tcl -- # # Initialization script normally executed in the interpreter for each Tk-based # application. Arranges class bindings for widgets. # # Copyright (c) 1992-1994 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. # Copyright (c) 1998-2000 Ajuba Solutions. # # See the file "license.terms" for information on usage and redistribution of # this file, and for a DISCLAIMER OF ALL WARRANTIES. # Verify that we have Tk binary and script components from the same release package require -exact Tk 8.6.8 # Create a ::tk namespace namespace eval ::tk { # Set up the msgcat commands namespace eval msgcat { namespace export mc mcmax if {[interp issafe] || [catch {package require msgcat}]} { |
︙ | ︙ | |||
596 597 598 599 600 601 602 603 | } return $result } # ::tk::AmpMenuArgs -- # Processes arguments for a menu entry, turning -label option into # -label and -underline options, returned by ::tk::UnderlineAmpersand. # | > | | | 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 | } return $result } # ::tk::AmpMenuArgs -- # Processes arguments for a menu entry, turning -label option into # -label and -underline options, returned by ::tk::UnderlineAmpersand. # The cmd argument is supposed to be either "add" or "entryconfigure" # proc ::tk::AmpMenuArgs {widget cmd type args} { set options {} foreach {opt val} $args { if {$opt eq "-label"} { lassign [UnderlineAmpersand $val] newlabel under lappend options -label $newlabel -underline $under } else { lappend options $opt $val } } $widget $cmd $type {*}$options } # ::tk::FindAltKeyTarget -- # Search recursively through the hierarchy of visible widgets to find # button or label which has $char as underlined character. # proc ::tk::FindAltKeyTarget {path char} { |
︙ | ︙ |
Changes to library/ttk/altTheme.tcl.
︙ | ︙ | |||
91 92 93 94 95 96 97 | -expand [list selected {2 2 1 0}] \ ; # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Treeview -background $colors(-window) ttk::style map Treeview \ | > > | > > | | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | -expand [list selected {2 2 1 0}] \ ; # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Treeview -background $colors(-window) ttk::style map Treeview \ -background [list disabled $colors(-frame)\ {!disabled !selected} $colors(-window) \ selected $colors(-selectbg)] \ -foreground [list disabled $colors(-disabledfg) \ {!disabled !selected} black \ selected $colors(-selectfg)] ttk::style configure TScale \ -groovewidth 4 -troughrelief sunken \ -sliderwidth raised -borderwidth 2 ttk::style configure TProgressbar \ -background $colors(-selectbg) -borderwidth 0 } |
︙ | ︙ |
Changes to library/ttk/aquaTheme.tcl.
︙ | ︙ | |||
37 38 39 40 41 42 43 | # Combobox: ttk::style configure TCombobox -postoffset {5 -2 -10 0} # Treeview: ttk::style configure Heading -font TkHeadingFont ttk::style configure Treeview -rowheight 18 -background White ttk::style map Treeview \ | > > | | > > > | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | # Combobox: ttk::style configure TCombobox -postoffset {5 -2 -10 0} # Treeview: ttk::style configure Heading -font TkHeadingFont ttk::style configure Treeview -rowheight 18 -background White ttk::style map Treeview \ -background [list disabled systemDialogBackgroundInactive \ {!disabled !selected} systemWindowBody \ {selected background} systemHighlightSecondary \ selected systemHighlight] \ -foreground [list disabled systemModelessDialogInactiveText \ {!disabled !selected} black \ selected systemModelessDialogActiveText] # Enable animation for ttk::progressbar widget: ttk::style configure TProgressbar -period 100 -maxphase 255 # For Aqua, labelframe labels should appear outside the border, # with a 14 pixel inset and 4 pixels spacing between border and label # (ref: Apple Human Interface Guidelines / Controls / Grouping Controls) |
︙ | ︙ |
Changes to library/ttk/clamTheme.tcl.
︙ | ︙ | |||
127 128 129 130 131 132 133 | ; # Treeview: ttk::style configure Heading \ -font TkHeadingFont -relief raised -padding {3} ttk::style configure Treeview -background $colors(-window) ttk::style map Treeview \ | > > | > > | | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | ; # Treeview: ttk::style configure Heading \ -font TkHeadingFont -relief raised -padding {3} ttk::style configure Treeview -background $colors(-window) ttk::style map Treeview \ -background [list disabled $colors(-frame)\ {!disabled !selected} $colors(-window) \ selected $colors(-selectbg)] \ -foreground [list disabled $colors(-disabledfg) \ {!disabled !selected} black \ selected $colors(-selectfg)] ttk::style configure TLabelframe \ -labeloutside true -labelmargins {0 0 0 4} \ -borderwidth 2 -relief raised ttk::style configure TProgressbar -background $colors(-frame) |
︙ | ︙ |
Changes to library/ttk/classicTheme.tcl.
︙ | ︙ | |||
94 95 96 97 98 99 100 | -background $colors(-troughbg) ttk::style map TNotebook.Tab -background [list selected $colors(-frame)] # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Treeview -background $colors(-window) ttk::style map Treeview \ | > > | > > | | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | -background $colors(-troughbg) ttk::style map TNotebook.Tab -background [list selected $colors(-frame)] # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Treeview -background $colors(-window) ttk::style map Treeview \ -background [list disabled $colors(-frame)\ {!disabled !selected} $colors(-window) \ selected $colors(-selectbg)] \ -foreground [list disabled $colors(-disabledfg) \ {!disabled !selected} black \ selected $colors(-selectfg)] # # Toolbar buttons: # ttk::style configure Toolbutton -padding 2 -relief flat -shiftrelief 2 ttk::style map Toolbutton -relief \ {disabled flat selected sunken pressed sunken active raised} |
︙ | ︙ |
Changes to library/ttk/defaults.tcl.
︙ | ︙ | |||
106 107 108 109 110 111 112 | # Treeview. # ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Treeview \ -background $colors(-window) \ -foreground $colors(-text) ; ttk::style map Treeview \ | > > | > > | | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | # Treeview. # ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Treeview \ -background $colors(-window) \ -foreground $colors(-text) ; ttk::style map Treeview \ -background [list disabled $colors(-frame)\ {!disabled !selected} $colors(-window) \ selected $colors(-selectbg)] \ -foreground [list disabled $colors(-disabledfg) \ {!disabled !selected} black \ selected $colors(-selectfg)] # Combobox popdown frame ttk::style layout ComboboxPopdownFrame { ComboboxPopdownFrame.border -sticky nswe } ttk::style configure ComboboxPopdownFrame \ -borderwidth 1 -relief solid |
︙ | ︙ |
Changes to library/ttk/vistaTheme.tcl.
︙ | ︙ | |||
42 43 44 45 46 47 48 | ttk::style map TNotebook.Tab \ -expand [list selected {2 2 2 2}] # Treeview: ttk::style configure Heading -font TkHeadingFont ttk::style configure Treeview -background SystemWindow ttk::style map Treeview \ | > > | > > | | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | ttk::style map TNotebook.Tab \ -expand [list selected {2 2 2 2}] # Treeview: ttk::style configure Heading -font TkHeadingFont ttk::style configure Treeview -background SystemWindow ttk::style map Treeview \ -background [list disabled SystemButtonFace \ {!disabled !selected} SystemWindow \ selected SystemHighlight] \ -foreground [list disabled SystemGrayText \ {!disabled !selected} SystemWindowText \ selected SystemHighlightText] # Label and Toolbutton ttk::style configure TLabelframe.Label -foreground "#0046d5" ttk::style configure Toolbutton -padding {4 4} # Combobox |
︙ | ︙ |
Changes to library/ttk/winTheme.tcl.
︙ | ︙ | |||
67 68 69 70 71 72 73 | ttk::style configure TNotebook.Tab -padding {3 1} -borderwidth 1 ttk::style map TNotebook.Tab -expand [list selected {2 2 2 0}] # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Treeview -background SystemWindow ttk::style map Treeview \ | > > | > > | | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | ttk::style configure TNotebook.Tab -padding {3 1} -borderwidth 1 ttk::style map TNotebook.Tab -expand [list selected {2 2 2 0}] # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Treeview -background SystemWindow ttk::style map Treeview \ -background [list disabled SystemButtonFace \ {!disabled !selected} SystemWindow \ selected SystemHighlight] \ -foreground [list disabled SystemGrayText \ {!disabled !selected} SystemWindowText \ selected SystemHighlightText] ttk::style configure TProgressbar \ -background SystemHighlight -borderwidth 0 ; } } |
Changes to library/ttk/xpTheme.tcl.
︙ | ︙ | |||
57 58 59 60 61 62 63 64 65 | ttk::style map TSpinbox \ -selectbackground [list !focus SystemWindow] \ -selectforeground [list !focus SystemWindowText] \ ; ttk::style configure Toolbutton -padding {4 4} } } | > > > > > > > > > > | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | ttk::style map TSpinbox \ -selectbackground [list !focus SystemWindow] \ -selectforeground [list !focus SystemWindowText] \ ; ttk::style configure Toolbutton -padding {4 4} # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Treeview -background SystemWindow ttk::style map Treeview \ -background [list disabled SystemButtonFace \ {!disabled !selected} SystemWindow \ selected SystemHighlight] \ -foreground [list disabled SystemGrayText \ {!disabled !selected} SystemWindowText \ selected SystemHighlightText]; } } |
Changes to macosx/README.
|
| | | | | | | | | | | | | 1 2 3 4 5 6 7 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 | Tcl/Tk macOS README ---------------------- This is the README file for the macOS/Darwin version of Tcl/Tk. 1. Where to go for support -------------------------- - The tcl-mac mailing list on sourceforge is the best place to ask questions specific to Tcl & Tk on macOS: http://lists.sourceforge.net/lists/listinfo/tcl-mac (this page also has a link to searchable archives of the list, please check them before asking on the list, many questions have already been answered). - For general Tcl/Tk questions, the newsgroup comp.lang.tcl is your best bet: http://groups.google.com/group/comp.lang.tcl/ - The Tcl'ers Wiki also has many pages dealing with Tcl & Tk on macOS, see http://wiki.tcl.tk/_/ref?N=3753 http://wiki.tcl.tk/_/ref?N=8361 - Please report bugs with Tk on macOS to the tracker: http://core.tcl.tk/tk/reportlist 2. Using Tcl/Tk on macOS --------------------------- - There are two versions of Tk available on macOS: TkAqua using the native aqua widgets and look&feel, and TkX11 using the traditional unix X11 wigets. TkX11 requires an X11 server to be installed, such as Apple's X11 (which is available as an optional or default install on recent macOS). TkAqua and TkX11 can be distinguished at runtime via [tk windowingsystem]. - At a minimum, macOS 10.3 is required to run Tcl and TkX11. TkAqua requires macOS 10.6 or later. - Unless weak-linking is used, Tcl/Tk built on macOS 10.x will not run on 10.y with y < x; on the other hand Tcl/Tk built on 10.y will always run on 10.x with y <= x (but without any of the fixes and optimizations that would be available in a binary built on 10.x). Weak-linking is available on OS X 10.2 or later, it additionally allows Tcl/Tk built on 10.x to run on any 10.y with x > y >= z (for a chosen z >= 2). - Wish checks the Resources/Scripts directory in its application bundle for a |
︙ | ︙ | |||
58 59 60 61 62 63 64 | $pkg/Resources/Scripts/pkgIndex.tcl as well as the usual $pkg/pkgIndex.tcl. This allows building extensions as frameworks with all script files contained in the Resources/Scripts directory of the framework. - [load]able binary extensions can linked as either ordinary shared libraries (.dylib) or as MachO bundles (since 8.4.10/8.5a3); bundles have the advantage that they are [load]ed more efficiently from a tcl VFS (no temporary copy to the | | < | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | $pkg/Resources/Scripts/pkgIndex.tcl as well as the usual $pkg/pkgIndex.tcl. This allows building extensions as frameworks with all script files contained in the Resources/Scripts directory of the framework. - [load]able binary extensions can linked as either ordinary shared libraries (.dylib) or as MachO bundles (since 8.4.10/8.5a3); bundles have the advantage that they are [load]ed more efficiently from a tcl VFS (no temporary copy to the native filesystem required). - The 'deploy' target of macosx/GNUmakefile installs the html manpages into the standard documentation location in the Tcl/Tk frameworks: Tcl.framework/Resources/Documentation/Reference/Tcl Tk.framework/Resources/Documentation/Reference/Tk No nroff manpages are installed by default by the GNUmakefile. |
︙ | ︙ | |||
159 160 161 162 163 164 165 | application's Info.plist (or displaying an alert if no Help Book is set). This action can be customized by defining a procedure named [tk::mac::ShowHelp], if present, this procedure is invoked instead by the standard Help menu item. Support for the Window menu and [tk::mac::ShowHelp] was added with the Cocoa-based Tk 8.5.7. - The TkAqua-specific command [tk::unsupported::MacWindowStyle style] is used to | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | | | < | > | < | | | > | | 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 | application's Info.plist (or displaying an alert if no Help Book is set). This action can be customized by defining a procedure named [tk::mac::ShowHelp], if present, this procedure is invoked instead by the standard Help menu item. Support for the Window menu and [tk::mac::ShowHelp] was added with the Cocoa-based Tk 8.5.7. - The TkAqua-specific command [tk::unsupported::MacWindowStyle style] is used to get and set macOS-specific toplevel window class and attributes. Note that the window class and many attributes have to be set before the window is first mapped for the change to have any effect. The command has the following syntax: tk::unsupported::MacWindowStyle style window ?class? ?attributes? The 2 argument form returns a list of the current class and attributes for the given window. The 3 argument form sets the class for the given window using the default attributes for that class. The 4 argument form sets the class and the list of attributes for the given window. Window class names: document, modal, floating, utility, toolbar, simple, help, overlay Window attribute names: standardDocument, standardFloating, resizable, fullZoom, horizontalZoom, verticalZoom, closeBox, collapseBox, toolbarButton, sideTitlebar, noTitleBar, unifiedTitleAndToolbar, metal, hud, noShadow, doesNotCycle, noActivates, hideOnSuspend, inWindowMenu, ignoreClicks, doesNotHide, canJoinAllSpaces, moveToActiveSpace, nonActivating Note that not all attributes are valid for all window classes. Support for the 3 argument form was added with the Cocoa-based Tk 8.5.7, at the same time support for some legacy Carbon-specific classes and attributes was removed (they are still accepted by the command but no longer have any effect). If you want to use Remote Debugging with Xcode, you need to set the environment variable XCNOSTDIN to 1 in the Executable editor for Wish. That will cause us to force closing stdin & stdout. Otherwise, given how Xcode launches Wish remotely, they will be left open and then Wish & gdb will fight for stdin. 3. Building Tcl/Tk on macOS ------------------------------ - At least macOS 10.3 is required to build Tcl and TkX11, and macOS 10.6 is required to build TkAqua. The XCode application provides everything needed to build Tk, but it is not necessary to install the full XCode. It suffices to install the Command Line Tools package, which can be done by running the command: xcode-selecct --install - Tcl/Tk are most easily built as macOS frameworks via GNUmakefile in tcl/macosx and tk/macosx (see below for details), but can also be built with the standard unix configure and make buildsystem in tcl/unix resp. tk/unix as on any other unix platform (indeed, the GNUmakefiles are just wrappers around the unix buildsystem). The macOS specific configure flags are --enable-aqua, --enable-framework and --disable-corefoundation (which disables CF and notably reverts to the standard select based notifier). Note that --enable-aqua is incompatible with --disable-corefoundation (for both Tcl and Tk configure). - It was once possible to build with the Xcode IDE via the projects in tk/macosx, but this has not been tested recently. Take care to use the project matching your DevTools and OS version: Tk.xcode: for Xcode 3.1 on 10.5 Tk.xcodeproj: for Xcode 3.2 on 10.6 These have the following targets: Tk: calls through to tk/macosx/GNUMakefile, requires a corresponding build of the Tcl target of tcl/macosx/Tcl.xcode. tktest: static build of TkAqua tktest for debugging. |
︙ | ︙ | |||
288 289 290 291 292 293 294 | directories are named differently, e.g. '../../tcl8.6' and '../../tk8.6', you need to manually change the TCL_SRCROOT and TK_SRCROOT settings by editing your ${USER}.pbxuser file (located inside the Tk.xcodeproj bundle directory) with a text editor. - To build universal binaries outside of the Xcode IDE, set CFLAGS as follows: export CFLAGS="-arch i386 -arch x86_64 -arch ppc" | | | | | 253 254 255 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 | directories are named differently, e.g. '../../tcl8.6' and '../../tk8.6', you need to manually change the TCL_SRCROOT and TK_SRCROOT settings by editing your ${USER}.pbxuser file (located inside the Tk.xcodeproj bundle directory) with a text editor. - To build universal binaries outside of the Xcode IDE, set CFLAGS as follows: export CFLAGS="-arch i386 -arch x86_64 -arch ppc" This requires macOS 10.4 and Xcode 2.4 (or Xcode 2.2 if -arch x86_64 is omitted, but _not_ Xcode 2.1) and will work on any architecture (on PowerPC Tiger you need to add "-isysroot /Developer/SDKs/MacOSX10.4u.sdk"). Note that configure requires CFLAGS to contain a least one architecture that can be run on the build machine (i.e. ppc on G3/G4, ppc or ppc64 on G5, ppc or i386 on Core and ppc, i386 or x86_64 on Core2/Xeon). Universal builds of Tcl TEA extensions are also possible with CFLAGS set as above, they will be [load]able by universal as well as thin binaries of Tcl. - To enable weak-linking, set the MACOSX_DEPLOYMENT_TARGET environment variable to the minimal OS version the binaries should be able to run on, e.g: export MACOSX_DEPLOYMENT_TARGET=10.6 This requires at least gcc 3.1; with gcc 4 or later, set/add to CFLAGS instead: export CFLAGS="-mmacosx-version-min=10.6" Support for weak-linking was added with 8.4.14/8.5a5. Detailed Instructions for building with macosx/GNUmakefile ---------------------------------------------------------- - Unpack the Tcl and Tk source release archives and place the tcl and tk source trees in a common parent directory. |
︙ | ︙ | |||
385 386 387 388 389 390 391 | make overrides to the tk/macosx GNUmakefile, e.g. make -C tk${ver}/macosx \ TCL_FRAMEWORK_DIR=$HOME/Library/Frameworks TCLSH_DIR=$HOME/usr/bin sudo make -C tk${ver}/macosx install \ TCL_FRAMEWORK_DIR=$HOME/Library/Frameworks TCLSH_DIR=$HOME/usr/bin The Makefile variables TCL_FRAMEWORK_DIR and TCLSH_DIR were added with Tk 8.4.3. | | | > > > | > > > > > | | | | | | | > | < | | | | | > > | > | | > | | > > > > > > > > | | | > > | > > > > > > > > | | | | > > > > > > > > > | | | | | > > | > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 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 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 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 521 522 523 524 525 526 527 528 529 530 531 532 533 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 | make overrides to the tk/macosx GNUmakefile, e.g. make -C tk${ver}/macosx \ TCL_FRAMEWORK_DIR=$HOME/Library/Frameworks TCLSH_DIR=$HOME/usr/bin sudo make -C tk${ver}/macosx install \ TCL_FRAMEWORK_DIR=$HOME/Library/Frameworks TCLSH_DIR=$HOME/usr/bin The Makefile variables TCL_FRAMEWORK_DIR and TCLSH_DIR were added with Tk 8.4.3. 4. Details regarding the macOS port of Tk. ------------------------------------------- 4.1 About the event loop ~~~~~~~~~~~~~~~~~~~~~~~~ The main program in a typical OSX application looks like this (see https://developer.apple.com/library/mac/documentation/Cocoa/\ Reference/ApplicationKit/Classes/NSApplication_Class) void NSApplicationMain(int argc, char *argv[]) { [NSApplication sharedApplication]; [NSBundle loadNibNamed:@"myMain" owner:NSApp]; [NSApp run]; } Here NSApp is a standard global variable, initialized by the OS, which points to an object in a subclass of NSApplication (called TKApplication in the case of the macOS port of Tk). The [NSApp run] method implements the event loop for a typical Mac application. There are three key steps in the run method. First it calls [NSApp finishLaunching], which creates the bouncing application icon and does other mysterious things. Second it creates an NSAutoreleasePool. Third, it starts an event loop which drains the NSAutoreleasePool every time the queue is empty, and replaces the drained pool with a new one. This third step is essential to preventing memory leaks, since the internal methods of Appkit objects all assume that an autorelease pool is in scope and will be drained when the event processing cycle ends. The macOS Tk application does not call the [NSApp run] method at all. Instead it uses the event loop built in to Tk. So the application must take care to replicate the important features of the method ourselves. The way that autorelease pools are handled is discussed in 4.2 below. Here we discuss the event handling itself. The Tcl event loop simply consists of repeated calls to TclDoOneEvent. Each call to TclDoOneEvent begins by collecting all pending events from an "event source", converting them to Tcl events and adding them to the Tcl event queue. For macOS, the event source is the NSApp object, which maintains an event queue even though its run method will never be called to process them. The NSApp provides methods for inspecting the queue and removing events from it as well as the [NSApp sendevent] which sends an event to all of the application's NSWindows which can then send it to subwindows, etc. The event collection process consists of first calling a platform specific SetupProc and then a platform specific CheckProc. In the macOS port, these are named TkMacOSXEventsSetupProc and TkMacOSXEventsCheckProc. It is important to understand that the Apple window manager does not have the concept of an expose event. Their replacement for an expose event is to have the window manager call the [NSView drawRect] method in any situation where an expose event for that NSView would be generated in X11. The [NSView drawRect] method is a no-op which is expected to be overridden by any application. In the case of Tcl, the replacement [NSView drawRect] method creates a Tcl expose event for each dirty rectangle of the NSView, and then adds the expose event to the Tcl queue. 4.2 Autorelease pools ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In order to carry out the job of managing autorelease pools, which would normally be handled by the [NSApp run] method, a private NSAUtoreleasePool* property is added to the TkApplication subclass of NSApplication. The TkpInit function calls [NSApp _setup] which initializes this property by creating an NSAutoreleasePool prior to calling [NSApp finishLaunching]. This mimics the behavior of the [NSApp run] method, which calls [NSApp finishLaunching] just before starting the event loop. Since the CheckProc function gets called for every Tk event, it is an appropriate place to drain the main NSAutoreleasePool and replace it with a new pool. This is done by calling the method [NSApp _resetAutoreleasePool], where _resetAutoreleasePool is a method which we define for the subclass. Unfortunately, by itself this is not sufficient for safe memory managememt because, as was made painfully evident with the release of OS X 10.13, it is possible for calls to TclDoOneEvent, and hence to CheckProc, to be nested. Draining the autorelease pool in a nested call leads to crashes as objects in use by the outer call can get freed by the inner call and then reused later. One particular situation where this happens is when a modal dialogue gets posted by a Tk Application. To address this, the NSApp object also implements a semaphore to prevent draining the autorelease pool in nested calls to CheckProc. One additional minor caveat for developers is that there are several steps of the Tk initialization which precede the call to TkpInit. Notably, the font package is initialized first. Since there is no NSAUtoreleasePool in scope prior to calling TkpInit, the functions called in these preliminary stages need to create and drain their own NSAutoreleasePools whenever they call methods of Appkit objects (e.g. NSFont). 4.3 Clipping regions and "ghost windows" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Another unusual aspect of the macOS port is its use of clipping regions. It was part of Daniel Steffen's original design that the TkWindowPrivate struct maintains three HIShapeRef regions, named visRgn, aboveVisRgn and drawRgn. These regions are used as clipping masks whenever drawing into an NSView. The visRgn is the bounding box of the window with a rectangle removed for each subwindow and for each sibling window at a higher stacking level. The drawRgn is the intersection of the visRgn with the clipping rectangle of the window. (Normally, the clipping rectangle is the same as the bounding rectangle, but drawing can be clipped to a smaller rectangle by calling TkpClipDrawableToRect.) The aboveVisRgn is the intersection of the window's bounding rectangle with the bounding rectangle of the parent window. Much of the code in tkMacOSXSubindows.c is devoted to rebuilding these clipping regions whenever something changes in the layout of the windows. This turns out to be a tricky thing to do and it is extremely prone to errors which can be difficult to trace. It is not entirely clear what the original reason for using these clipping regions was. But one benefit is that if they are correctly maintained then it allows windows to be drawn in any order. You do not have to draw them in the order of the window hierarchy. Each window can draw its entire rectangle through its own mask and never have to worry about drawing in the wrong place. It is likely that the need for using clipping regions arose because, as Apple explicitly states in the documentation for [NSView subviews], "The order of the subviews may be considered as being back-to-front, but this does not imply invalidation and drawing behavior." In the early versions of the macOS port, buttons were implemented as subviews of class TkButton. This probably exacerbated the likelihood that Tk windows would need to be drawn in arbitrary order. The most obvious side effect caused by not maintaining the clipping regions is the appearance of so-called "ghost windows". A common situation where these may arise is when a window containing buttons is being scrolled. A user may see two images of the same button on the screen, one in the pre-scroll location and one in the post-scroll location. To see how these 'ghost windows' can arise, think about what happens if the clipping regions are not maintained correctly. A window might have a rectangle missing from its clipping region because that rectangle is the bounding rectangle for a subwindow, say a button. The parent should not draw in the missing rectangle since doing so would trash the button. The button is responsible for drawing there. Now imagine that the button gets moved, say by a scroll, but the missing rectangle in the parent's clipping region does not get moved correctly, or it gets moved later on, after the parent has redrawn itself. The parent would still not be allowed to draw in the old rectangle, so the user would continue to see the image of the button in its old location, as well as another image in the new location. This is a prototypical example of a "ghost window". Anytime you see a "ghost window", you should suspect problems with the updates to the clipping region visRgn. It is natural to look for timing issues, race conditions, or other "event loop problems". But in fact, the whole design of the code is to make those timing issues irrelevant. As long as the clipping regions are correctly maintained the timing does not matter. And if they are not correctly maintained then you will see "ghost windows". It is worth including a detailed description of one specific place where the failure to correctly maintain clipping regions caused "ghost window" artifacts that plagued the macOS port for years. These occurred when scrolling a Text widget which contained embedded subwindows. It involved some specific differences between the low-level behavior of Apple's window manager versus those of the other platforms, and the fix ultimately required changes in the generic Tk implementation (documented in the comments in the DisplayText function). The Text widget attempts to improve perfomance when scrolling by minimizing the number of text lines which need to be redisplayed. It does this by calling the platform-specific TkScrollWindow function which uses a low-level routine to map one rectangle of the window to another. The TkScrollWindow function returns a damage region which is then used by the Text widget's DisplayText function to determine which text lines need to be redrawn. On the unix and win platforms, this damage region includes bounding rectangles for all embedded windows inside the Text widget. The way that this works is system dependent. On unix, the low level scrolling is done by XCopyRegion, which generates a GraphicsExpose event for each embedded window. These GraphicsExposed events are processsed within TkScrollWindow, using a special handler which adds the bounding rectangle of each subwindow to the damage region. On the win platform the damage region is built by the low level function ScrollWindowEx, and it also includes bounding rectangles for all embedded windows. This is possible because on X11 and Windows every Tk widget is also known to the window manager as a window. The situation is different on macOS. The underlying object for a top level window on macOS is the NSView. However, Apple explicitly warns in its documentation that performance degradation occurs when an NSView has more than about 100 subviews. A Text widget with thousands of lines of text could easily contain more than 100 embedded windows. In fact, while the original Cocoa port of Tk did use the NSButton object, which is derived from NSView, as the basis for its Tk Buttons, that was changed in order to improve performance. Moreover, the low level routine used for scrolling on macOS, namely [NSView scrollrect:by], does not provide any damage information. So TkScrollWindow needs to work differently on macOS. Since it would be inefficient to iterate through all embedded windows in a Text widget, looking for those which meet the scrolling area, the damage region constructed by TkScrollWindow contains only the difference between the source and destination rectangles for the scrolling. The embedded windows are redrawn within the DisplayText function by some conditional code which is only used for macOS. |
Changes to macosx/Tk-Common.xcconfig.
︙ | ︙ | |||
38 39 40 41 42 43 44 | TCL_BUILD_DIR = $(OBJROOT)/../tcl/Tcl.build/$(CONFIGURATION)/Tcl.build/Objects TCL_CONFIGURE_ARGS = --enable-threads --enable-dtrace TCL_FRAMEWORK_DIR = $(SYMROOT)/../tcl/$(CONFIGURATION) TCL_LIBRARY = $(LIBDIR)/tcl$(VERSION) TCL_PACKAGE_PATH = "$(LIBDIR)" TCL_DEFS = HAVE_TCL_CONFIG_H TK_LIBRARY = $(LIBDIR)/tk$(VERSION) | | | 38 39 40 41 42 43 44 45 46 | TCL_BUILD_DIR = $(OBJROOT)/../tcl/Tcl.build/$(CONFIGURATION)/Tcl.build/Objects TCL_CONFIGURE_ARGS = --enable-threads --enable-dtrace TCL_FRAMEWORK_DIR = $(SYMROOT)/../tcl/$(CONFIGURATION) TCL_LIBRARY = $(LIBDIR)/tcl$(VERSION) TCL_PACKAGE_PATH = "$(LIBDIR)" TCL_DEFS = HAVE_TCL_CONFIG_H TK_LIBRARY = $(LIBDIR)/tk$(VERSION) TK_DEFS = HAVE_TK_CONFIG_H VERSION = 8.6 |
Changes to macosx/Tk.xcode/project.pbxproj.
︙ | ︙ | |||
1979 1980 1981 1982 1983 1984 1985 | F96D446A08F272B9004A47F5 /* tclUnixThrd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclUnixThrd.h; sourceTree = "<group>"; }; F96D446B08F272B9004A47F5 /* tclUnixTime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixTime.c; sourceTree = "<group>"; }; F96D446C08F272B9004A47F5 /* tclXtNotify.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclXtNotify.c; sourceTree = "<group>"; }; F96D446D08F272B9004A47F5 /* tclXtTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclXtTest.c; sourceTree = "<group>"; }; F96D447008F272BA004A47F5 /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; }; F96D447108F272BA004A47F5 /* buildall.vc.bat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = buildall.vc.bat; sourceTree = "<group>"; }; F96D447208F272BA004A47F5 /* cat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cat.c; sourceTree = "<group>"; }; | < | 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 | F96D446A08F272B9004A47F5 /* tclUnixThrd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclUnixThrd.h; sourceTree = "<group>"; }; F96D446B08F272B9004A47F5 /* tclUnixTime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixTime.c; sourceTree = "<group>"; }; F96D446C08F272B9004A47F5 /* tclXtNotify.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclXtNotify.c; sourceTree = "<group>"; }; F96D446D08F272B9004A47F5 /* tclXtTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclXtTest.c; sourceTree = "<group>"; }; F96D447008F272BA004A47F5 /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; }; F96D447108F272BA004A47F5 /* buildall.vc.bat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = buildall.vc.bat; sourceTree = "<group>"; }; F96D447208F272BA004A47F5 /* cat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cat.c; sourceTree = "<group>"; }; F96D447408F272BA004A47F5 /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; }; F96D447508F272BA004A47F5 /* configure.in */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.in; sourceTree = "<group>"; }; F96D447708F272BA004A47F5 /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; }; F96D447808F272BA004A47F5 /* makefile.vc */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = makefile.vc; sourceTree = "<group>"; }; F96D447908F272BA004A47F5 /* nmakehlp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nmakehlp.c; sourceTree = "<group>"; }; F96D447A08F272BA004A47F5 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; }; F96D447C08F272BA004A47F5 /* rules.vc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rules.vc; sourceTree = "<group>"; }; |
︙ | ︙ | |||
3812 3813 3814 3815 3816 3817 3818 | }; F96D446E08F272B9004A47F5 /* win */ = { isa = PBXGroup; children = ( F96D447008F272BA004A47F5 /* aclocal.m4 */, F96D447108F272BA004A47F5 /* buildall.vc.bat */, F96D447208F272BA004A47F5 /* cat.c */, | < | 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 | }; F96D446E08F272B9004A47F5 /* win */ = { isa = PBXGroup; children = ( F96D447008F272BA004A47F5 /* aclocal.m4 */, F96D447108F272BA004A47F5 /* buildall.vc.bat */, F96D447208F272BA004A47F5 /* cat.c */, F96D447408F272BA004A47F5 /* configure */, F96D447508F272BA004A47F5 /* configure.in */, F96D447708F272BA004A47F5 /* Makefile.in */, F96D447808F272BA004A47F5 /* makefile.vc */, F96D447908F272BA004A47F5 /* nmakehlp.c */, F96D447A08F272BA004A47F5 /* README */, F96D447C08F272BA004A47F5 /* rules.vc */, |
︙ | ︙ |
Changes to macosx/Tk.xcodeproj/project.pbxproj.
︙ | ︙ | |||
1979 1980 1981 1982 1983 1984 1985 | F96D446A08F272B9004A47F5 /* tclUnixThrd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclUnixThrd.h; sourceTree = "<group>"; }; F96D446B08F272B9004A47F5 /* tclUnixTime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixTime.c; sourceTree = "<group>"; }; F96D446C08F272B9004A47F5 /* tclXtNotify.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclXtNotify.c; sourceTree = "<group>"; }; F96D446D08F272B9004A47F5 /* tclXtTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclXtTest.c; sourceTree = "<group>"; }; F96D447008F272BA004A47F5 /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; }; F96D447108F272BA004A47F5 /* buildall.vc.bat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = buildall.vc.bat; sourceTree = "<group>"; }; F96D447208F272BA004A47F5 /* cat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cat.c; sourceTree = "<group>"; }; | < | 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 | F96D446A08F272B9004A47F5 /* tclUnixThrd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclUnixThrd.h; sourceTree = "<group>"; }; F96D446B08F272B9004A47F5 /* tclUnixTime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixTime.c; sourceTree = "<group>"; }; F96D446C08F272B9004A47F5 /* tclXtNotify.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclXtNotify.c; sourceTree = "<group>"; }; F96D446D08F272B9004A47F5 /* tclXtTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclXtTest.c; sourceTree = "<group>"; }; F96D447008F272BA004A47F5 /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; }; F96D447108F272BA004A47F5 /* buildall.vc.bat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = buildall.vc.bat; sourceTree = "<group>"; }; F96D447208F272BA004A47F5 /* cat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cat.c; sourceTree = "<group>"; }; F96D447408F272BA004A47F5 /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; }; F96D447508F272BA004A47F5 /* configure.in */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.in; sourceTree = "<group>"; }; F96D447708F272BA004A47F5 /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; }; F96D447808F272BA004A47F5 /* makefile.vc */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = makefile.vc; sourceTree = "<group>"; }; F96D447908F272BA004A47F5 /* nmakehlp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nmakehlp.c; sourceTree = "<group>"; }; F96D447A08F272BA004A47F5 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; }; F96D447C08F272BA004A47F5 /* rules.vc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rules.vc; sourceTree = "<group>"; }; |
︙ | ︙ | |||
3812 3813 3814 3815 3816 3817 3818 | }; F96D446E08F272B9004A47F5 /* win */ = { isa = PBXGroup; children = ( F96D447008F272BA004A47F5 /* aclocal.m4 */, F96D447108F272BA004A47F5 /* buildall.vc.bat */, F96D447208F272BA004A47F5 /* cat.c */, | < | 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 | }; F96D446E08F272B9004A47F5 /* win */ = { isa = PBXGroup; children = ( F96D447008F272BA004A47F5 /* aclocal.m4 */, F96D447108F272BA004A47F5 /* buildall.vc.bat */, F96D447208F272BA004A47F5 /* cat.c */, F96D447408F272BA004A47F5 /* configure */, F96D447508F272BA004A47F5 /* configure.in */, F96D447708F272BA004A47F5 /* Makefile.in */, F96D447808F272BA004A47F5 /* makefile.vc */, F96D447908F272BA004A47F5 /* nmakehlp.c */, F96D447A08F272BA004A47F5 /* README */, F96D447C08F272BA004A47F5 /* rules.vc */, |
︙ | ︙ |
Changes to macosx/Wish-Info.plist.in.
︙ | ︙ | |||
65 66 67 68 69 70 71 | <key>CFBundleShortVersionString</key> <string>@TK_VERSION@@TK_PATCH_LEVEL@</string> <key>CFBundleSignature</key> <string>WiSH</string> <key>CFBundleVersion</key> <string>@TK_VERSION@@TK_PATCH_LEVEL@</string> <key>LSMinimumSystemVersion</key> | | | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | <key>CFBundleShortVersionString</key> <string>@TK_VERSION@@TK_PATCH_LEVEL@</string> <key>CFBundleSignature</key> <string>WiSH</string> <key>CFBundleVersion</key> <string>@TK_VERSION@@TK_PATCH_LEVEL@</string> <key>LSMinimumSystemVersion</key> <string>10.6.0</string> <key>LSRequiresCarbon</key> <true/> <key>NSAppleScriptEnabled</key> <true/> <key>OSAScriptingDefinition</key> <string>Wish.sdef</string> <key>NSHighResolutionCapable</key> |
︙ | ︙ |
Changes to macosx/tkMacOSXBitmap.c.
︙ | ︙ | |||
8 9 10 11 12 13 14 | * Copyright (c) 2006-2009 Daniel A. Steffen <[email protected]> * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | * Copyright (c) 2006-2009 Daniel A. Steffen <[email protected]> * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXConstants.h" /* * This structure holds information about native bitmaps. */ typedef struct { const char *name; /* Name of icon. */ OSType iconType; /* OSType of icon. */ |
︙ | ︙ | |||
294 295 296 297 298 299 300 | if (image) { [image setSize:size]; } } else { string = [NSString stringWithUTF8String:name]; image = [NSImage imageNamed:string]; if (!image) { | | | 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | if (image) { [image setSize:size]; } } else { string = [NSString stringWithUTF8String:name]; image = [NSImage imageNamed:string]; if (!image) { NSURL *url = [NSURL fileURLWithPath:string]; if (url) { image = [[[NSImage alloc] initWithContentsOfURL:url] autorelease]; } } if (image) { size = [image size]; |
︙ | ︙ |
Changes to macosx/tkMacOSXButton.c.
︙ | ︙ | |||
360 361 362 363 364 365 366 | width += butPtr->indicatorSpace; } else if (haveImage) { /* Image only */ width = butPtr->width > 0 ? butPtr->width : width + butPtr->indicatorSpace; height = butPtr->height > 0 ? butPtr->height : height; } else { /* Text only */ | > | | 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 | width += butPtr->indicatorSpace; } else if (haveImage) { /* Image only */ width = butPtr->width > 0 ? butPtr->width : width + butPtr->indicatorSpace; height = butPtr->height > 0 ? butPtr->height : height; } else { /* Text only */ /*Add four pixels of padding to width for text-only buttons to improve appearance.*/ width = txtWidth + butPtr->indicatorSpace + 4; height = txtHeight; if (butPtr->width > 0) { width = butPtr->width * charWidth; } if (butPtr->height > 0) { height = butPtr->height * fm.linespace; } |
︙ | ︙ |
Changes to macosx/tkMacOSXColor.c.
︙ | ︙ | |||
262 263 264 265 266 267 268 | break; } case TRANSPARENT_PIXEL: rgba[3] = 0.0; break; } | < < < < | | 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | break; } case TRANSPARENT_PIXEL: rgba[3] = 0.0; break; } static CGColorSpaceRef deviceRGBSpace = NULL; if (!deviceRGBSpace) { deviceRGBSpace = CGColorSpaceCreateDeviceRGB(); } *c = CGColorCreate(deviceRGBSpace, rgba ); } return err; } /* |
︙ | ︙ |
Added macosx/tkMacOSXConstants.h.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 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 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 95 | /* * tkMacOSXConstants.h -- * * Macros which map the names of NS constants used in the Tk code to * the new name that Apple came up with for subsequent versions of the * operating system. (Each new OS release seems to come with a new * naming convention for the same old constants.) * * Copyright (c) 2017 Marc Culler * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef _TKMACCONSTANTS #define _TKMACCONSTANTS /* * Let's raise a glass for the project manager who improves our lives by * generating deprecation warnings about pointless changes of the names * of constants. */ #if MAC_OS_X_VERSION_MIN_REQUIRED >= 101000 #define NSOKButton NSModalResponseOK #endif #if MAC_OS_X_VERSION_MIN_REQUIRED >= 101200 #define NSAppKitDefined NSEventTypeAppKitDefined #define NSApplicationActivatedEventType NSEventSubtypeApplicationActivated #define NSApplicationDeactivatedEventType NSEventSubtypeApplicationDeactivated #define NSWindowExposedEventType NSEventSubtypeWindowExposed #define NSScreenChangedEventType NSEventSubtypeScreenChanged #define NSWindowMovedEventType NSEventSubtypeWindowMoved #define NSKeyUp NSEventTypeKeyUp #define NSKeyDown NSEventTypeKeyDown #define NSFlagsChanged NSEventTypeFlagsChanged #define NSLeftMouseDown NSEventTypeLeftMouseDown #define NSLeftMouseUp NSEventTypeLeftMouseUp #define NSRightMouseDown NSEventTypeRightMouseDown #define NSRightMouseUp NSEventTypeRightMouseUp #define NSLeftMouseDragged NSEventTypeLeftMouseDragged #define NSRightMouseDragged NSEventTypeRightMouseDragged #define NSMouseMoved NSEventTypeMouseMoved #define NSMouseEntered NSEventTypeMouseEntered #define NSMouseExited NSEventTypeMouseExited #define NSScrollWheel NSEventTypeScrollWheel #define NSOtherMouseDown NSEventTypeOtherMouseDown #define NSOtherMouseUp NSEventTypeOtherMouseUp #define NSOtherMouseDragged NSEventTypeOtherMouseDragged #define NSTabletPoint NSEventTypeTabletPoint #define NSTabletProximity NSEventTypeTabletProximity #define NSDeviceIndependentModifierFlagsMask NSEventModifierFlagDeviceIndependentFlagsMask #define NSCommandKeyMask NSEventModifierFlagCommand #define NSShiftKeyMask NSEventModifierFlagShift #define NSAlphaShiftKeyMask NSEventModifierFlagCapsLock #define NSAlternateKeyMask NSEventModifierFlagOption #define NSControlKeyMask NSEventModifierFlagControl #define NSNumericPadKeyMask NSEventModifierFlagNumericPad #define NSFunctionKeyMask NSEventModifierFlagFunction #define NSCursorUpdate NSEventTypeCursorUpdate #define NSTexturedBackgroundWindowMask NSWindowStyleMaskTexturedBackground #define NSCompositeCopy NSCompositingOperationCopy #define NSWarningAlertStyle NSAlertStyleWarning #define NSInformationalAlertStyle NSAlertStyleInformational #define NSCriticalAlertStyle NSAlertStyleCritical #define NSCenterTextAlignment NSTextAlignmentCenter #define NSDeviceIndependentModifierFlagsMask NSEventModifierFlagDeviceIndependentFlagsMask #define NSCommandKeyMask NSEventModifierFlagCommand #define NSShiftKeyMask NSEventModifierFlagShift #define NSAlphaShiftKeyMask NSEventModifierFlagCapsLock #define NSAlternateKeyMask NSEventModifierFlagOption #define NSControlKeyMask NSEventModifierFlagControl #define NSNumericPadKeyMask NSEventModifierFlagNumericPad #define NSFunctionKeyMask NSEventModifierFlagFunction #define NSKeyUp NSEventTypeKeyUp #define NSKeyDown NSEventTypeKeyDown #define NSFlagsChanged NSEventTypeFlagsChanged #define NSAlphaShiftKeyMask NSEventModifierFlagCapsLock #define NSShiftKeyMask NSEventModifierFlagShift #define NSAnyEventMask NSEventMaskAny #define NSTexturedBackgroundWindowMask NSWindowStyleMaskTexturedBackground #define NSUtilityWindowMask NSWindowStyleMaskUtilityWindow #define NSNonactivatingPanelMask NSWindowStyleMaskNonactivatingPanel #define NSDocModalWindowMask NSWindowStyleMaskDocModalWindow #define NSHUDWindowMask NSWindowStyleMaskHUDWindow #define NSTitledWindowMask NSWindowStyleMaskTitled #define NSClosableWindowMask NSWindowStyleMaskClosable #define NSResizableWindowMask NSWindowStyleMaskResizable #define NSUnifiedTitleAndToolbarWindowMask NSWindowStyleMaskUnifiedTitleAndToolbar #define NSMiniaturizableWindowMask NSWindowStyleMaskMiniaturizable #define NSBorderlessWindowMask NSWindowStyleMaskBorderless #endif #endif |
Changes to macosx/tkMacOSXDefault.h.
︙ | ︙ | |||
321 322 323 324 325 326 327 | #define DEF_MENU_FONT "menu" /* special: see tkMacOSXMenu.c */ #define DEF_MENU_FG "systemMenuText" #define DEF_MENU_POST_COMMAND "" #define DEF_MENU_RELIEF "flat" #define DEF_MENU_SELECT_COLOR "systemMenuActive" #define DEF_MENU_SELECT_MONO BLACK #define DEF_MENU_TAKE_FOCUS "0" | < < < < < | 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | #define DEF_MENU_FONT "menu" /* special: see tkMacOSXMenu.c */ #define DEF_MENU_FG "systemMenuText" #define DEF_MENU_POST_COMMAND "" #define DEF_MENU_RELIEF "flat" #define DEF_MENU_SELECT_COLOR "systemMenuActive" #define DEF_MENU_SELECT_MONO BLACK #define DEF_MENU_TAKE_FOCUS "0" #define DEF_MENU_TEAROFF "0" #define DEF_MENU_TEAROFF_CMD ((char *) NULL) #define DEF_MENU_TITLE "" #define DEF_MENU_TYPE "normal" /* * Defaults for menubuttons: |
︙ | ︙ |
Changes to macosx/tkMacOSXDialog.c.
︙ | ︙ | |||
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 | * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkFileFilter.h" #if MAC_OS_X_VERSION_MIN_REQUIRED < 1090 #define modalOK NSOKButton #define modalCancel NSCancelButton #else #define modalOK NSModalResponseOK #define modalCancel NSModalResponseCancel #endif #define modalOther -1 #define modalError -2 /*Vars for filtering in "open file" and "save file" dialogs.*/ typedef struct { bool doFileTypes; // show the accessory view which displays the filter menu bool preselectFilter; // a filter was selected by the typevariable bool userHasSelectedFilter; // The user has changed the filter in the accessory view NSMutableArray *fileTypeNames; // array of names, e.g. "Text document" NSMutableArray *fileTypeExtensions; // array of allowed extensions per name, e.g. "txt", "doc" NSMutableArray *fileTypeLabels; // displayed string, e.g. "Text document (.txt, .doc)" | > > > > | > > | | 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 | * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkFileFilter.h" #include "tkMacOSXConstants.h" #if MAC_OS_X_VERSION_MIN_REQUIRED < 1090 #define modalOK NSOKButton #define modalCancel NSCancelButton #else #define modalOK NSModalResponseOK #define modalCancel NSModalResponseCancel #endif #define modalOther -1 #define modalError -2 /*Vars for filtering in "open file" and "save file" dialogs.*/ typedef struct { bool doFileTypes; // show the accessory view which displays the filter menu bool preselectFilter; // a filter was selected by the typevariable bool userHasSelectedFilter; // The user has changed the filter in the accessory view NSMutableArray *fileTypeNames; // array of names, e.g. "Text document" NSMutableArray *fileTypeExtensions; // array of allowed extensions per name, e.g. "txt", "doc" NSMutableArray *fileTypeLabels; // displayed string, e.g. "Text document (.txt, .doc)" NSMutableArray *fileTypeAllowsAll; // boolean if the all pattern (*.*) is included NSMutableArray *allowedExtensions; // set of all allowed extensions bool allowedExtensionsAllowAll; // set of all allowed extensions includes *.* NSUInteger fileTypeIndex; // index of currently selected filter } filepanelFilterInfo; filepanelFilterInfo filterInfo; NSOpenPanel *openpanel; NSSavePanel *savepanel; |
︙ | ︙ | |||
159 160 161 162 163 164 165 | [TYPE_YESNOCANCEL] = {5, 6, 4}, }; /* * Construct a file URL from directory and filename. Either may * be nil. If both are nil, returns nil. */ | < < < | | 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 | [TYPE_YESNOCANCEL] = {5, 6, 4}, }; /* * Construct a file URL from directory and filename. Either may * be nil. If both are nil, returns nil. */ static NSURL *getFileURL(NSString *directory, NSString *filename) { NSURL *url = nil; if (directory) { url = [NSURL fileURLWithPath:directory isDirectory:YES]; } if (filename) { url = [NSURL URLWithString:filename relativeToURL:url]; } return url; } #pragma mark TKApplication(TKDialog) @interface NSColorPanel(TKDialog) - (void) _setUseModalAppearance: (BOOL) flag; @end @implementation TKApplication(TKDialog) - (void) tkFilePanelDidEnd: (NSSavePanel *) panel returnCode: (NSInteger) returnCode contextInfo: (void *) contextInfo { FilePanelCallbackInfo *callbackInfo = contextInfo; if (returnCode == modalOK) { Tcl_Obj *resultObj; if (callbackInfo->multiple) { resultObj = Tcl_NewListObj(0, NULL); for (NSURL *url in [(NSOpenPanel*)panel URLs]) { Tcl_ListObjAppendElement(callbackInfo->interp, resultObj, Tcl_NewStringObj([[url path] UTF8String], -1)); |
︙ | ︙ | |||
214 215 216 217 218 219 220 | TkBackgroundEvalObjv(callbackInfo->interp, objc + 1, tmpv, TCL_EVAL_GLOBAL); ckfree(tmpv); } } else { Tcl_SetObjResult(callbackInfo->interp, resultObj); } | | | 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | TkBackgroundEvalObjv(callbackInfo->interp, objc + 1, tmpv, TCL_EVAL_GLOBAL); ckfree(tmpv); } } else { Tcl_SetObjResult(callbackInfo->interp, resultObj); } } else if (returnCode == modalCancel) { Tcl_ResetResult(callbackInfo->interp); } if (panel == [NSApp modalWindow]) { [NSApp stopModalWithCode:returnCode]; } if (callbackInfo->cmdObj) { Tcl_DecrRefCount(callbackInfo->cmdObj); |
︙ | ︙ | |||
264 265 266 267 268 269 270 | if (callbackInfo->cmdObj) { Tcl_DecrRefCount(callbackInfo->cmdObj); ckfree(callbackInfo); } } - (void)selectFormat:(id)sender { | | | | > > > > > | > | > > | > > | | | > > > > > | > > > > | 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 | if (callbackInfo->cmdObj) { Tcl_DecrRefCount(callbackInfo->cmdObj); ckfree(callbackInfo); } } - (void)selectFormat:(id)sender { NSPopUpButton *button = (NSPopUpButton *)sender; filterInfo.fileTypeIndex = [button indexOfSelectedItem]; if ([[filterInfo.fileTypeAllowsAll objectAtIndex:filterInfo.fileTypeIndex] boolValue]) { [openpanel setAllowsOtherFileTypes:YES]; /* setAllowsOtherFileTypes might have no effect; it's inherited from the * NSSavePanel, where it has the effect that it does not append an extension * Setting the allowed file types to nil allows selecting any file */ [openpanel setAllowedFileTypes:nil]; } else { NSMutableArray *allowedtypes = [filterInfo.fileTypeExtensions objectAtIndex:filterInfo.fileTypeIndex]; [openpanel setAllowedFileTypes:allowedtypes]; [openpanel setAllowsOtherFileTypes:NO]; } filterInfo.userHasSelectedFilter = true; } - (void)saveFormat:(id)sender { NSPopUpButton *button = (NSPopUpButton *)sender; filterInfo.fileTypeIndex = [button indexOfSelectedItem]; if ([[filterInfo.fileTypeAllowsAll objectAtIndex:filterInfo.fileTypeIndex] boolValue]) { [savepanel setAllowsOtherFileTypes:YES]; [savepanel setAllowedFileTypes:nil]; } else { NSMutableArray *allowedtypes = [filterInfo.fileTypeExtensions objectAtIndex:filterInfo.fileTypeIndex]; [savepanel setAllowedFileTypes:allowedtypes]; [savepanel setAllowsOtherFileTypes:NO]; } filterInfo.userHasSelectedFilter = true; } @end #pragma mark - /* |
︙ | ︙ | |||
371 372 373 374 375 376 377 | } if (initialColor) { [colorPanel setColor:initialColor]; } returnCode = [NSApp runModalForWindow:colorPanel]; if (returnCode == modalOK) { color = [[colorPanel color] colorUsingColorSpace: | | | 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 | } if (initialColor) { [colorPanel setColor:initialColor]; } returnCode = [NSApp runModalForWindow:colorPanel]; if (returnCode == modalOK) { color = [[colorPanel color] colorUsingColorSpace: [NSColorSpace deviceRGBColorSpace]]; numberOfComponents = [color numberOfComponents]; } if (color && numberOfComponents >= 3 && numberOfComponents <= 4) { CGFloat components[4]; char colorstr[8]; [color getComponents:components]; |
︙ | ︙ | |||
415 416 417 418 419 420 421 | filterInfo.doFileTypes = (fl.filters != NULL); filterInfo.fileTypeIndex = 0; filterInfo.fileTypeExtensions = [NSMutableArray array]; filterInfo.fileTypeNames = [NSMutableArray array]; filterInfo.fileTypeLabels = [NSMutableArray array]; | > > | > > > | | > > > > > > | 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 | filterInfo.doFileTypes = (fl.filters != NULL); filterInfo.fileTypeIndex = 0; filterInfo.fileTypeExtensions = [NSMutableArray array]; filterInfo.fileTypeNames = [NSMutableArray array]; filterInfo.fileTypeLabels = [NSMutableArray array]; filterInfo.fileTypeAllowsAll = [NSMutableArray array]; filterInfo.allowedExtensions = [NSMutableArray array]; filterInfo.allowedExtensionsAllowAll = NO; if (filterInfo.doFileTypes) { for (FileFilter *filterPtr = fl.filters; filterPtr; filterPtr = filterPtr->next) { NSString * name = [[NSString alloc] initWithUTF8String: filterPtr -> name]; [filterInfo.fileTypeNames addObject:name]; [name release]; NSMutableArray * clauseextensions = [NSMutableArray array]; NSMutableArray * displayextensions = [NSMutableArray array]; bool allowsAll = NO; for (FileFilterClause *clausePtr = filterPtr->clauses; clausePtr; clausePtr = clausePtr->next) { for (GlobPattern *globPtr = clausePtr->patterns; globPtr; globPtr = globPtr->next) { const char *str = globPtr->pattern; while (*str && (*str == '*' || *str == '.')) { str++; } if (*str) { NSString *extension = [[NSString alloc] initWithUTF8String:str]; if (![filterInfo.allowedExtensions containsObject:extension]) { [filterInfo.allowedExtensions addObject:extension]; } [clauseextensions addObject:extension]; [displayextensions addObject:[@"." stringByAppendingString:extension]]; [extension release]; } else { // it is the all pattern (*, .* or *.*) allowsAll = YES; filterInfo.allowedExtensionsAllowAll = YES; [displayextensions addObject:@"*"]; } } } [filterInfo.fileTypeExtensions addObject:clauseextensions]; [filterInfo.fileTypeAllowsAll addObject:[NSNumber numberWithBool:allowsAll]]; NSMutableString * label = [[NSMutableString alloc] initWithString:name]; [label appendString:@" ("]; [label appendString:[displayextensions componentsJoinedByString:@", "]]; [label appendString:@")"]; [filterInfo.fileTypeLabels addObject:label]; [label release]; |
︙ | ︙ | |||
483 484 485 486 487 488 489 490 491 492 493 494 495 496 | } } TkFreeFileFilters(&fl); return TCL_OK; } /* *---------------------------------------------------------------------- * * Tk_GetOpenFileObjCmd -- * | > > > > > > > > > > > | 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 | } } TkFreeFileFilters(&fl); return TCL_OK; } bool filterCompatible(NSString *extension, int filterIndex) { NSMutableArray *allowedExtensions = [filterInfo.fileTypeExtensions objectAtIndex: filterIndex]; /* If this contains the all pattern, accept any extension */ if ([[filterInfo.fileTypeAllowsAll objectAtIndex:filterIndex] boolValue]) { return true; } return [allowedExtensions containsObject: extension]; } /* *---------------------------------------------------------------------- * * Tk_GetOpenFileObjCmd -- * |
︙ | ︙ | |||
614 615 616 617 618 619 620 | [openpanel setAllowsMultipleSelection:multiple]; if (parseFileFilters(interp, fileTypesPtr, typeVariablePtr) != TCL_OK) { goto end; } if (filterInfo.doFileTypes) { | | | | | | > > > | | > | < < < < < < < < < < < < < < < < | > > > > > > > > > > > | > > > > > > | > > > > > > > > > > > > > > > > > > > | > > | | 658 659 660 661 662 663 664 665 666 667 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 746 747 748 749 750 751 752 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 | [openpanel setAllowsMultipleSelection:multiple]; if (parseFileFilters(interp, fileTypesPtr, typeVariablePtr) != TCL_OK) { goto end; } if (filterInfo.doFileTypes) { NSView *accessoryView = [[NSView alloc] initWithFrame:NSMakeRect(0.0, 0.0, 300, 32.0)]; NSTextField *label = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 60, 22)]; [label setEditable:NO]; [label setStringValue:@"Filter:"]; [label setBordered:NO]; [label setBezeled:NO]; [label setDrawsBackground:NO]; NSPopUpButton *popupButton = [[NSPopUpButton alloc] initWithFrame:NSMakeRect(50.0, 2, 240, 22.0) pullsDown:NO]; [popupButton addItemsWithTitles:filterInfo.fileTypeLabels]; [popupButton setAction:@selector(selectFormat:)]; [accessoryView addSubview:label]; [accessoryView addSubview:popupButton]; if (filterInfo.preselectFilter) { /* A specific filter was selected from the typevariable. Select it and * open the accessory view */ [popupButton selectItemAtIndex:filterInfo.fileTypeIndex]; /* on OSX > 10.11, the optons are not visible by default. Ergo allow all file types [openpanel setAllowedFileTypes:filterInfo.fileTypeExtensions[filterInfo.fileTypeIndex]]; */ [openpanel setAllowedFileTypes:filterInfo.allowedExtensions]; } else { [openpanel setAllowedFileTypes:filterInfo.allowedExtensions]; } if (filterInfo.allowedExtensionsAllowAll) { [openpanel setAllowsOtherFileTypes:YES]; } else { [openpanel setAllowsOtherFileTypes:NO]; } [openpanel setAccessoryView:accessoryView]; } else { /* No filters are given. Allow picking all files */ [openpanel setAllowsOtherFileTypes:YES]; } if (cmdObj) { callbackInfo = ckalloc(sizeof(FilePanelCallbackInfo)); if (Tcl_IsShared(cmdObj)) { cmdObj = Tcl_DuplicateObj(cmdObj); } Tcl_IncrRefCount(cmdObj); } callbackInfo->cmdObj = cmdObj; callbackInfo->interp = interp; callbackInfo->multiple = multiple; parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window); if (haveParentOption && parent && ![parent attachedSheet]) { parentIsKey = [parent isKeyWindow]; if (directory || filename ) { NSURL * fileURL = getFileURL(directory, filename); [openpanel setDirectoryURL:fileURL]; } [openpanel beginSheetModalForWindow:parent completionHandler:^(NSInteger returnCode) { [NSApp tkFilePanelDidEnd:openpanel returnCode:returnCode contextInfo:callbackInfo ]; } ]; modalReturnCode = cmdObj ? modalOther : [NSApp runModalForWindow:openpanel]; } else { if (directory || filename ) { NSURL * fileURL = getFileURL(directory, filename); [openpanel setDirectoryURL:fileURL]; } modalReturnCode = [openpanel runModal]; [NSApp tkFilePanelDidEnd:openpanel returnCode:modalReturnCode contextInfo:callbackInfo]; } result = (modalReturnCode != modalError) ? TCL_OK : TCL_ERROR; if (parentIsKey) { [parent makeKeyWindow]; } if ((typeVariablePtr && (modalReturnCode == NSOKButton)) && filterInfo.doFileTypes) { /* * The -typevariable must be set to the selected file type, if the dialog was not cancelled */ NSInteger selectedFilterIndex = filterInfo.fileTypeIndex; NSString *selectedFilter = NULL; if (filterInfo.userHasSelectedFilter) { selectedFilterIndex = filterInfo.fileTypeIndex; selectedFilter = [filterInfo.fileTypeNames objectAtIndex:selectedFilterIndex]; } else { /* Difficult case: the user has not touched the filter settings, but we must * return something in the typevariable. First check if the preselected type is compatible * with the selected file, otherwise choose the first compatible type from the list, * finally fall back to the empty string */ NSURL *selectedFile; if (multiple) { // Use the first file in the case of multiple selection // Anyway it is not overly useful here selectedFile = [[openpanel URLs] objectAtIndex:0]; } else { selectedFile = [openpanel URL]; } NSString *extension = [selectedFile pathExtension]; if (filterInfo.preselectFilter && filterCompatible(extension, filterInfo.fileTypeIndex)) { selectedFilterIndex = filterInfo.fileTypeIndex; // The preselection from the typevariable selectedFilter = [filterInfo.fileTypeNames objectAtIndex:selectedFilterIndex]; } else { // scan the list int i; for (i = 0; i < [filterInfo.fileTypeNames count]; i++) { if (filterCompatible(extension, i)) { selectedFilterIndex = i; break; } } if (i == selectedFilterIndex) { selectedFilter = [filterInfo.fileTypeNames objectAtIndex:selectedFilterIndex]; } else { selectedFilter = @""; } } } Tcl_ObjSetVar2(interp, typeVariablePtr, NULL, Tcl_NewStringObj([selectedFilter UTF8String], -1), TCL_GLOBAL_ONLY); } end: return result; |
︙ | ︙ | |||
862 863 864 865 866 867 868 | } if (parseFileFilters(interp, fileTypesPtr, typeVariablePtr) != TCL_OK) { goto end; } if (filterInfo.doFileTypes) { | | | | | | 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 | } if (parseFileFilters(interp, fileTypesPtr, typeVariablePtr) != TCL_OK) { goto end; } if (filterInfo.doFileTypes) { NSView *accessoryView = [[NSView alloc] initWithFrame:NSMakeRect(0.0, 0.0, 300, 32.0)]; NSTextField *label = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 60, 22)]; [label setEditable:NO]; [label setStringValue:NSLocalizedString(@"Format:", nil)]; [label setBordered:NO]; [label setBezeled:NO]; [label setDrawsBackground:NO]; NSPopUpButton *popupButton = [[NSPopUpButton alloc] initWithFrame:NSMakeRect(50.0, 2, 340, 22.0) pullsDown:NO]; [popupButton addItemsWithTitles:filterInfo.fileTypeLabels]; [popupButton selectItemAtIndex:filterInfo.fileTypeIndex]; [popupButton setAction:@selector(saveFormat:)]; [accessoryView addSubview:label]; [accessoryView addSubview:popupButton]; [savepanel setAccessoryView:accessoryView]; [savepanel setAllowedFileTypes:[filterInfo.fileTypeExtensions objectAtIndex:filterInfo.fileTypeIndex]]; [savepanel setAllowsOtherFileTypes:filterInfo.allowedExtensionsAllowAll]; } else if (defaultType) { /* If no filetypes are given, defaultextension is an alternative way * to specify the attached extension. Just propose this extension, * but don't display an accessory view */ NSMutableArray *AllowedFileTypes = [NSMutableArray array]; [AllowedFileTypes addObject:defaultType]; [savepanel setAllowedFileTypes:AllowedFileTypes]; |
︙ | ︙ | |||
909 910 911 912 913 914 915 | callbackInfo->cmdObj = cmdObj; callbackInfo->interp = interp; callbackInfo->multiple = 0; parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window); if (haveParentOption && parent && ![parent attachedSheet]) { parentIsKey = [parent isKeyWindow]; | < < < < < < < < < | < < < < < < < < < < < | | 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 | callbackInfo->cmdObj = cmdObj; callbackInfo->interp = interp; callbackInfo->multiple = 0; parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window); if (haveParentOption && parent && ![parent attachedSheet]) { parentIsKey = [parent isKeyWindow]; if (directory) { [savepanel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]]; } /*check for file name, otherwise set to empty string; crashes with uncaught exception if set to nil*/ if (filename) { [savepanel setNameFieldStringValue:filename]; } else { [savepanel setNameFieldStringValue:@""]; } [savepanel beginSheetModalForWindow:parent completionHandler:^(NSInteger returnCode) { [NSApp tkFilePanelDidEnd:savepanel returnCode:returnCode contextInfo:callbackInfo ]; } ]; modalReturnCode = cmdObj ? modalOther : [NSApp runModalForWindow:savepanel]; } else { if (directory) { [savepanel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]]; } /*check for file name, otherwise set to empty string; crashes with uncaught exception if set to nil*/ if (filename) { [savepanel setNameFieldStringValue:filename]; } else { [savepanel setNameFieldStringValue:@""]; } modalReturnCode = [savepanel runModal]; [NSApp tkFilePanelDidEnd:savepanel returnCode:modalReturnCode contextInfo:callbackInfo]; } result = (modalReturnCode != modalError) ? TCL_OK : TCL_ERROR; if (parentIsKey) { [parent makeKeyWindow]; } if ((typeVariablePtr && (modalReturnCode == NSOKButton)) && filterInfo.doFileTypes) { /* * The -typevariable must be set to the selected file type, if the dialog was not cancelled */ NSString * selectedFilter = [filterInfo.fileTypeNames objectAtIndex:filterInfo.fileTypeIndex]; Tcl_ObjSetVar2(interp, typeVariablePtr, NULL, Tcl_NewStringObj([selectedFilter UTF8String], -1), TCL_GLOBAL_ONLY); } end: return result; |
︙ | ︙ | |||
1086 1087 1088 1089 1090 1091 1092 | callbackInfo->multiple = 0; /*check for directory value, set to root if not specified; otherwise crashes with exception because of nil string parameter*/ if (!directory) { directory = @"/"; } parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window); if (haveParentOption && parent && ![parent attachedSheet]) { | | < < < < < < < < < < < < < | 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 | callbackInfo->multiple = 0; /*check for directory value, set to root if not specified; otherwise crashes with exception because of nil string parameter*/ if (!directory) { directory = @"/"; } parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window); if (haveParentOption && parent && ![parent attachedSheet]) { parentIsKey = [parent isKeyWindow]; [panel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]]; [panel beginSheetModalForWindow:parent completionHandler:^(NSInteger returnCode) { [NSApp tkFilePanelDidEnd:panel returnCode:returnCode contextInfo:callbackInfo ]; } ]; modalReturnCode = cmdObj ? modalOther : [NSApp runModalForWindow:panel]; } else { [panel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]]; modalReturnCode = [panel runModal]; [NSApp tkFilePanelDidEnd:panel returnCode:modalReturnCode contextInfo:callbackInfo]; } result = (modalReturnCode != modalError) ? TCL_OK : TCL_ERROR; if (parentIsKey) { [parent makeKeyWindow]; } |
︙ | ︙ |
Changes to macosx/tkMacOSXDraw.c.
︙ | ︙ | |||
12 13 14 15 16 17 18 | * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXDebug.h" | < | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXDebug.h" #include "tkButton.h" /* #ifdef TK_MAC_DEBUG #define TK_MAC_DEBUG_DRAWING #define TK_MAC_DEBUG_IMAGE_DRAWING #endif |
︙ | ︙ | |||
41 42 43 44 45 46 47 | static int useThemedFrame = 0; /* * Prototypes for functions used only in this file. */ static void ClipToGC(Drawable d, GC gc, HIShapeRef *clipRgnPtr); | < < < < < < | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | static int useThemedFrame = 0; /* * Prototypes for functions used only in this file. */ static void ClipToGC(Drawable d, GC gc, HIShapeRef *clipRgnPtr); /* *---------------------------------------------------------------------- * * TkMacOSXInitCGDrawing -- * * Initializes link vars that control CG drawing. |
︙ | ︙ | |||
104 105 106 107 108 109 110 | } return TCL_OK; } /* *---------------------------------------------------------------------- * | | | | > | | | | < > | > | | < | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 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 | } return TCL_OK; } /* *---------------------------------------------------------------------- * * TkMacOSXBitmapRepFromDrawableRect * * Extract bitmap data from a MacOSX drawable as an NSBitmapImageRep. * * Results: * Returns an NSBitmapRep representing the image of the given * rectangle of the given drawable. This object is retained. * The caller is responsible for releasing it. * * NOTE: The x,y coordinates should be relative to a coordinate system with * origin at the top left, as used by XImage and CGImage, not bottom * left as used by NSView. * * Side effects: * None * *---------------------------------------------------------------------- */ NSBitmapImageRep* TkMacOSXBitmapRepFromDrawableRect( Drawable drawable, int x, int y, unsigned int width, unsigned int height) { MacDrawable *mac_drawable = (MacDrawable *) drawable; CGContextRef cg_context=NULL; CGImageRef cg_image=NULL, sub_cg_image=NULL; NSBitmapImageRep *bitmap_rep=NULL; NSView *view=NULL; if ( mac_drawable->flags & TK_IS_PIXMAP ) { /* * This means that the MacDrawable is functioning as a * Tk Pixmap, so its view field is NULL. */ cg_context = TkMacOSXGetCGContextForDrawable(drawable); CGRect image_rect = CGRectMake(x, y, width, height); cg_image = CGBitmapContextCreateImage( (CGContextRef) cg_context); sub_cg_image = CGImageCreateWithImageInRect(cg_image, image_rect); if ( sub_cg_image ) { bitmap_rep = [NSBitmapImageRep alloc]; [bitmap_rep initWithCGImage:sub_cg_image]; } if ( cg_image ) { CGImageRelease(cg_image); } } else if ( (view = TkMacOSXDrawableView(mac_drawable)) ) { /* * Convert Tk top-left to NSView bottom-left coordinates. */ int view_height = [view bounds].size.height; NSRect view_rect = NSMakeRect(x + mac_drawable->xOff, view_height - height - y - mac_drawable->yOff, width, height); if ( [view lockFocusIfCanDraw] ) { bitmap_rep = [NSBitmapImageRep alloc]; bitmap_rep = [bitmap_rep initWithFocusedViewRect:view_rect]; [view unlockFocus]; } else { TkMacOSXDbgMsg("Could not lock focus on view."); } |
︙ | ︙ | |||
226 227 228 229 230 231 232 | /*TkMacOSXDbgMsg("Failed to setup drawing context.");*/ } if ( dc.context ) { if (srcDraw->flags & TK_IS_PIXMAP) { img = TkMacOSXCreateCGImageWithDrawable(src); }else if (TkMacOSXDrawableWindow(src)) { | | | | 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | /*TkMacOSXDbgMsg("Failed to setup drawing context.");*/ } if ( dc.context ) { if (srcDraw->flags & TK_IS_PIXMAP) { img = TkMacOSXCreateCGImageWithDrawable(src); }else if (TkMacOSXDrawableWindow(src)) { bitmap_rep = TkMacOSXBitmapRepFromDrawableRect(src, src_x, src_y, width, height); if ( bitmap_rep ) { img = [bitmap_rep CGImage]; } } else { TkMacOSXDbgMsg("Invalid source drawable - neither window nor pixmap."); } if (img) { TkMacOSXDrawCGImage(dst, gc, dc.context, img, gc->foreground, gc->background, CGRectMake(0, 0, srcDraw->size.width, srcDraw->size.height), CGRectMake(src_x, src_y, width, height), CGRectMake(dest_x, dest_y, width, height)); CFRelease(img); } else { |
︙ | ︙ | |||
335 336 337 338 339 340 341 | CGContextFillRect(context, rect); CGContextRestoreGState(context); CGImageRelease(img); CGImageRelease(mask); CGImageRelease(submask); CGImageRelease(subimage); } else { | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 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 | CGContextFillRect(context, rect); CGContextRestoreGState(context); CGImageRelease(img); CGImageRelease(mask); CGImageRelease(submask); CGImageRelease(subimage); } else { TkMacOSXDrawCGImage(dst, gc, dc.context, img, gc->foreground, imageBackground, CGRectMake(0, 0, srcDraw->size.width, srcDraw->size.height), CGRectMake(src_x, src_y, width, height), CGRectMake(dest_x, dest_y, width, height)); CGImageRelease(img); } } else { /* no image */ TkMacOSXDbgMsg("Invalid source drawable"); } } else { TkMacOSXDbgMsg("Invalid destination drawable - could not get a bitmap context."); } TkMacOSXRestoreDrawingContext(&dc); } else { /* source drawable is a window, not a Pixmap */ XCopyArea(display, src, dst, gc, src_x, src_y, width, height, dest_x, dest_y); } } /* *---------------------------------------------------------------------- * * TkMacOSXCreateCGImageWithDrawable -- * * Create a CGImage from the given Drawable. |
︙ | ︙ | |||
526 527 528 529 530 531 532 | */ CGImageRef TkMacOSXCreateCGImageWithDrawable( Drawable drawable) { CGImageRef img = NULL; | | | 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | */ CGImageRef TkMacOSXCreateCGImageWithDrawable( Drawable drawable) { CGImageRef img = NULL; CGContextRef context = TkMacOSXGetCGContextForDrawable(drawable); if (context) { img = CGBitmapContextCreateImage(context); } return img; } |
︙ | ︙ | |||
594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 | TkMacOSXGetNSImageWithTkImage( Display *display, Tk_Image image, int width, int height) { Pixmap pixmap = Tk_GetPixmap(display, None, width, height, 0); NSImage *nsImage; Tk_RedrawImage(image, 0, 0, width, height, pixmap, 0, 0); nsImage = CreateNSImageWithPixmap(pixmap, width, height); Tk_FreePixmap(display, pixmap); return [nsImage autorelease]; } | > > | 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 | TkMacOSXGetNSImageWithTkImage( Display *display, Tk_Image image, int width, int height) { Pixmap pixmap = Tk_GetPixmap(display, None, width, height, 0); MacDrawable *macDraw = (MacDrawable *) pixmap; NSImage *nsImage; macDraw->flags |= TK_USE_XIMAGE_ALPHA; Tk_RedrawImage(image, 0, 0, width, height, pixmap, 0, 0); nsImage = CreateNSImageWithPixmap(pixmap, width, height); Tk_FreePixmap(display, pixmap); return [nsImage autorelease]; } |
︙ | ︙ | |||
645 646 647 648 649 650 651 | return [nsImage autorelease]; } /* *---------------------------------------------------------------------- * | | | | | | | 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 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 | return [nsImage autorelease]; } /* *---------------------------------------------------------------------- * * TkMacOSXGetCGContextForDrawable -- * * Get CGContext for given Drawable, creating one if necessary. * * Results: * CGContext. * * Side effects: * None. * *---------------------------------------------------------------------- */ CGContextRef TkMacOSXGetCGContextForDrawable( Drawable drawable) { MacDrawable *macDraw = (MacDrawable *) drawable; if (macDraw && (macDraw->flags & TK_IS_PIXMAP) && !macDraw->context) { const size_t bitsPerComponent = 8; size_t bitsPerPixel, bytesPerRow, len; CGColorSpaceRef colorspace = NULL; CGBitmapInfo bitmapInfo = #ifdef __LITTLE_ENDIAN__ kCGBitmapByteOrder32Host; #else kCGBitmapByteOrderDefault; #endif char *data; CGRect bounds = CGRectMake(0, 0, macDraw->size.width, macDraw->size.height); if (macDraw->flags & TK_IS_BW_PIXMAP) { bitsPerPixel = 8; bitmapInfo = (CGBitmapInfo)kCGImageAlphaOnly; } else { colorspace = CGColorSpaceCreateDeviceRGB(); bitsPerPixel = 32; bitmapInfo |= kCGImageAlphaPremultipliedFirst; } bytesPerRow = ((size_t) macDraw->size.width * bitsPerPixel + 127) >> 3 & ~15; len = macDraw->size.height * bytesPerRow; data = ckalloc(len); |
︙ | ︙ | |||
707 708 709 710 711 712 713 | return (macDraw ? macDraw->context : NULL); } /* *---------------------------------------------------------------------- * | | | | 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 | return (macDraw ? macDraw->context : NULL); } /* *---------------------------------------------------------------------- * * TkMacOSXDrawCGImage -- * * Draw CG image into drawable. * * Results: * None. * * Side effects: * None. * *---------------------------------------------------------------------- */ void TkMacOSXDrawCGImage( Drawable d, GC gc, CGContextRef context, CGImageRef image, unsigned long imageForeground, unsigned long imageBackground, CGRect imageBounds, |
︙ | ︙ | |||
1482 1483 1484 1485 1486 1487 1488 | * * TkScrollWindow -- * * Scroll a rectangle of the specified window and accumulate * a damage region. * * Results: | | | 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 | * * TkScrollWindow -- * * Scroll a rectangle of the specified window and accumulate * a damage region. * * Results: * Returns 0 if the scroll generated no additional damage. * Otherwise, sets the region that needs to be repainted after * scrolling and returns 1. * * Side effects: * Scrolls the bits in the window. * *---------------------------------------------------------------------- |
︙ | ︙ | |||
1512 1513 1514 1515 1516 1517 1518 | HIShapeRef dmgRgn = NULL, extraRgn = NULL; NSRect bounds, visRect, scrollSrc, scrollDst; int result = 0; if ( view ) { /* Get the scroll area in NSView coordinates (origin at bottom left). */ bounds = [view bounds]; | | < < | < < < < < < < < < < < < < < < < < < < < < < < < | 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 | HIShapeRef dmgRgn = NULL, extraRgn = NULL; NSRect bounds, visRect, scrollSrc, scrollDst; int result = 0; if ( view ) { /* Get the scroll area in NSView coordinates (origin at bottom left). */ bounds = [view bounds]; scrollSrc = NSMakeRect(macDraw->xOff + x, bounds.size.height - height - (macDraw->yOff + y), width, height); scrollDst = NSOffsetRect(scrollSrc, dx, -dy); /* Limit scrolling to the window content area. */ visRect = [view visibleRect]; scrollSrc = NSIntersectionRect(scrollSrc, visRect); scrollDst = NSIntersectionRect(scrollDst, visRect); if ( !NSIsEmptyRect(scrollSrc) && !NSIsEmptyRect(scrollDst) ) { /* * Mark the difference between source and destination as damaged. * This region is described in NSView coordinates (y=0 at the bottom) * and converted to Tk coordinates later. */ srcRect = CGRectMake(x, y, width, height); dstRect = CGRectOffset(srcRect, dx, dy); /* Compute the damage. */ dmgRgn = HIShapeCreateMutableWithRect(&srcRect); extraRgn = HIShapeCreateWithRect(&dstRect); ChkErr(HIShapeDifference, dmgRgn, extraRgn, (HIMutableShapeRef) dmgRgn); result = HIShapeIsEmpty(dmgRgn) ? 0 : 1; /* Convert to Tk coordinates, offset by the window origin. */ TkMacOSXSetWithNativeRegion(damageRgn, dmgRgn); if (extraRgn) { CFRelease(extraRgn); } /* Scroll the rectangle. */ [view scrollRect:scrollSrc by:NSMakeSize(dx, -dy)]; } } else { dmgRgn = HIShapeCreateEmpty(); TkMacOSXSetWithNativeRegion(damageRgn, dmgRgn); } if (dmgRgn) { |
︙ | ︙ | |||
1647 1648 1649 1650 1651 1652 1653 | ClipToGC(d, gc, &dc.clipRgn); dontDraw = dc.clipRgn ? HIShapeIsEmpty(dc.clipRgn) : 0; } if (dontDraw) { goto end; } if (useCG) { | | | 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 | ClipToGC(d, gc, &dc.clipRgn); dontDraw = dc.clipRgn ? HIShapeIsEmpty(dc.clipRgn) : 0; } if (dontDraw) { goto end; } if (useCG) { dc.context = TkMacOSXGetCGContextForDrawable(d); } if (!dc.context || !(macDraw->flags & TK_IS_PIXMAP)) { isWin = (TkMacOSXDrawableWindow(d) != nil); } if (dc.context) { dc.portBounds = clipBounds = CGContextGetClipBoundingBox(dc.context); } else if (isWin) { |
︙ | ︙ |
Changes to macosx/tkMacOSXEmbed.c.
︙ | ︙ | |||
189 190 191 192 193 194 195 | * *---------------------------------------------------------------------- */ int TkpScanWindowId( Tcl_Interp *interp, | | | 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | * *---------------------------------------------------------------------- */ int TkpScanWindowId( Tcl_Interp *interp, const char * string, Window *idPtr) { int code; Tcl_Obj obj; obj.refCount = 1; obj.bytes = (char *) string; /* DANGER?! */ |
︙ | ︙ | |||
795 796 797 798 799 800 801 802 803 804 805 806 807 808 | ClientData clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { TkWindow *winPtr = clientData; Container *containerPtr; Tk_ErrorHandler errHandler; /* * Ignore any X protocol errors that happen in this procedure (almost any * operation could fail, for example, if the embedded application has * deleted its window). */ errHandler = Tk_CreateErrorHandler(eventPtr->xfocus.display, -1, | > > > > > > > | 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 | ClientData clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { TkWindow *winPtr = clientData; Container *containerPtr; Tk_ErrorHandler errHandler; if (!firstContainerPtr) { /* * When the interpreter is being dismantled this can be nil. */ return; } /* * Ignore any X protocol errors that happen in this procedure (almost any * operation could fail, for example, if the embedded application has * deleted its window). */ errHandler = Tk_CreateErrorHandler(eventPtr->xfocus.display, -1, |
︙ | ︙ |
Changes to macosx/tkMacOSXEvent.c.
︙ | ︙ | |||
10 11 12 13 14 15 16 17 18 19 20 21 22 23 | * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXEvent.h" #include "tkMacOSXDebug.h" #pragma mark TKApplication(TKEvent) enum { NSWindowWillMoveEventType = 20 }; | > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXEvent.h" #include "tkMacOSXDebug.h" #include "tkMacOSXConstants.h" #pragma mark TKApplication(TKEvent) enum { NSWindowWillMoveEventType = 20 }; |
︙ | ︙ | |||
84 85 86 87 88 89 90 | case NSApplicationDefined: { id win; win = [theEvent window]; break; } case NSCursorUpdate: break; | < < | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | case NSApplicationDefined: { id win; win = [theEvent window]; break; } case NSCursorUpdate: break; case NSEventTypeGesture: case NSEventTypeMagnify: case NSEventTypeRotate: case NSEventTypeSwipe: case NSEventTypeBeginGesture: case NSEventTypeEndGesture: break; #endif default: break; /* return theEvent */ } return processedEvent; } |
︙ | ︙ |
Changes to macosx/tkMacOSXFont.c.
︙ | ︙ | |||
255 256 257 258 259 260 261 | if (reqFaPtr) { *faPtr = *reqFaPtr; } else { TkInitFontAttributes(faPtr); } fontPtr->nsFont = nsFont; // some don't like antialiasing on fixed-width even if bigger than limit | | | 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | if (reqFaPtr) { *faPtr = *reqFaPtr; } else { TkInitFontAttributes(faPtr); } fontPtr->nsFont = nsFont; // some don't like antialiasing on fixed-width even if bigger than limit // dontAA = [nsFont isFixedPitch] && fontPtr->font.fa.size <= 10; if (antialiasedTextEnabled >= 0/* || dontAA*/) { renderingMode = (antialiasedTextEnabled == 0/* || dontAA*/) ? NSFontIntegerAdvancementsRenderingMode : NSFontAntialiasedRenderingMode; } nsFont = [nsFont screenFontWithRenderingMode:renderingMode]; GetTkFontAttributesForNSFont(nsFont, faPtr); |
︙ | ︙ | |||
815 816 817 818 819 820 821 | if (rangeStart < 0 || rangeLength <= 0 || rangeStart + rangeLength > numBytes || (maxLength == 0 && !(flags & TK_AT_LEAST_ONE))) { *lengthPtr = 0; return 0; } | < < < < < < < < < | 815 816 817 818 819 820 821 822 823 824 825 826 827 828 | if (rangeStart < 0 || rangeLength <= 0 || rangeStart + rangeLength > numBytes || (maxLength == 0 && !(flags & TK_AT_LEAST_ONE))) { *lengthPtr = 0; return 0; } if (maxLength > 32767) { maxLength = 32767; } string = [[NSString alloc] initWithBytesNoCopy:(void*)source length:numBytes encoding:NSUTF8StringEncoding freeWhenDone:NO]; if (!string) { length = 0; |
︙ | ︙ | |||
917 918 919 920 921 922 923 | "flags='%s%s%s%s' -> width=%d bytesFit=%d\n", source, rangeLength, source+rangeStart, maxLength, flags & TK_PARTIAL_OK ? "partialOk " : "", flags & TK_WHOLE_WORDS ? "wholeWords " : "", flags & TK_AT_LEAST_ONE ? "atLeastOne " : "", flags & TK_ISOLATE_END ? "isolateEnd " : "", length, fit); | < | 908 909 910 911 912 913 914 915 916 917 918 919 920 921 | "flags='%s%s%s%s' -> width=%d bytesFit=%d\n", source, rangeLength, source+rangeStart, maxLength, flags & TK_PARTIAL_OK ? "partialOk " : "", flags & TK_WHOLE_WORDS ? "wholeWords " : "", flags & TK_AT_LEAST_ONE ? "atLeastOne " : "", flags & TK_ISOLATE_END ? "isolateEnd " : "", length, fit); #endif *lengthPtr = length; return fit; } /* *--------------------------------------------------------------------------- |
︙ | ︙ |
Changes to macosx/tkMacOSXHLEvents.c.
︙ | ︙ | |||
32 33 34 35 36 37 38 | /* * Static functions used only in this file. */ static void tkMacOSXProcessFiles(NSAppleEventDescriptor* event, NSAppleEventDescriptor* replyEvent, Tcl_Interp *interp, | | | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | /* * Static functions used only in this file. */ static void tkMacOSXProcessFiles(NSAppleEventDescriptor* event, NSAppleEventDescriptor* replyEvent, Tcl_Interp *interp, const char* procedure); static int MissedAnyParameters(const AppleEvent *theEvent); static int ReallyKillMe(Tcl_Event *eventPtr, int flags); #pragma mark TKApplication(TKHLEvents) @implementation TKApplication(TKHLEvents) - (void) terminate: (id) sender |
︙ | ︙ | |||
273 274 275 276 277 278 279 | */ static void tkMacOSXProcessFiles( NSAppleEventDescriptor* event, NSAppleEventDescriptor* replyEvent, Tcl_Interp *interp, | | | | 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | */ static void tkMacOSXProcessFiles( NSAppleEventDescriptor* event, NSAppleEventDescriptor* replyEvent, Tcl_Interp *interp, const char* procedure) { Tcl_Encoding utf8; const AEDesc *fileSpecDesc = nil; AEDesc contents; char URLString[1 + URL_MAX_LENGTH]; NSURL *fileURL; DescType type; Size actual; long count, index; |
︙ | ︙ | |||
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 | /* * Construct a Tcl command which calls the procedure, passing the * paths contained in the AppleEvent as arguments. */ Tcl_DStringInit(&command); Tcl_DStringAppend(&command, procedure, -1); for (index = 1; index <= count; index++) { if (noErr != AEGetNthPtr(fileSpecDesc, index, typeFileURL, &keyword, &type, (Ptr) URLString, URL_MAX_LENGTH, &actual)) { continue; } if (type != typeFileURL) { continue; } URLString[actual] = '\0'; fileURL = [NSURL URLWithString:[NSString stringWithUTF8String:(char*)URLString]]; if (fileURL == nil) { continue; } Tcl_ExternalToUtfDString(utf8, [[fileURL path] UTF8String], -1, &pathName); Tcl_DStringAppendElement(&command, Tcl_DStringValue(&pathName)); Tcl_DStringFree(&pathName); } AEDisposeDesc(&contents); /* * Handle the event by evaluating the Tcl expression we constructed. */ code = Tcl_EvalEx(interp, Tcl_DStringValue(&command), Tcl_DStringLength(&command), TCL_EVAL_GLOBAL); if (code != TCL_OK) { Tcl_BackgroundException(interp, code); } Tcl_DStringFree(&command); | > > > < | 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 | /* * Construct a Tcl command which calls the procedure, passing the * paths contained in the AppleEvent as arguments. */ Tcl_DStringInit(&command); Tcl_DStringAppend(&command, procedure, -1); utf8 = Tcl_GetEncoding(NULL, "utf-8"); for (index = 1; index <= count; index++) { if (noErr != AEGetNthPtr(fileSpecDesc, index, typeFileURL, &keyword, &type, (Ptr) URLString, URL_MAX_LENGTH, &actual)) { continue; } if (type != typeFileURL) { continue; } URLString[actual] = '\0'; fileURL = [NSURL URLWithString:[NSString stringWithUTF8String:(char*)URLString]]; if (fileURL == nil) { continue; } Tcl_ExternalToUtfDString(utf8, [[fileURL path] UTF8String], -1, &pathName); Tcl_DStringAppendElement(&command, Tcl_DStringValue(&pathName)); Tcl_DStringFree(&pathName); } Tcl_FreeEncoding(utf8); AEDisposeDesc(&contents); /* * Handle the event by evaluating the Tcl expression we constructed. */ code = Tcl_EvalEx(interp, Tcl_DStringValue(&command), Tcl_DStringLength(&command), TCL_EVAL_GLOBAL); if (code != TCL_OK) { Tcl_BackgroundException(interp, code); } Tcl_DStringFree(&command); } /* *---------------------------------------------------------------------- * * TkMacOSXInitAppleEvents -- * |
︙ | ︙ |
Added macosx/tkMacOSXImage.c.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 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 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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 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 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 249 250 251 252 253 254 255 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 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 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 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 521 522 523 524 525 526 527 528 529 530 531 532 533 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 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 | /* * tkMacOSXImage.c -- * * The code in this file provides an interface for XImages, * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright 2001-2009, Apple Inc. * Copyright (c) 2005-2009 Daniel A. Steffen <[email protected]> * Copyright 2017 Marc Culler. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "xbytes.h" #pragma mark XImage handling int _XInitImageFuncPtrs( XImage *image) { return 0; } /* *---------------------------------------------------------------------- * * TkMacOSXCreateCGImageWithXImage -- * * Create CGImage from XImage, copying the image data. * * Results: * CGImage, release after use. * * Side effects: * None. * *---------------------------------------------------------------------- */ static void ReleaseData(void *info, const void *data, size_t size) { ckfree(info); } CGImageRef TkMacOSXCreateCGImageWithXImage( XImage *image, int use_ximage_alpha) { CGImageRef img = NULL; size_t bitsPerComponent, bitsPerPixel; size_t len = image->bytes_per_line * image->height; const CGFloat *decode = NULL; CGBitmapInfo bitmapInfo; CGDataProviderRef provider = NULL; char *data = NULL; CGDataProviderReleaseDataCallback releaseData = ReleaseData; if (image->bits_per_pixel == 1) { /* * BW image */ /* Reverses the sense of the bits */ static const CGFloat decodeWB[2] = {1, 0}; decode = decodeWB; bitsPerComponent = 1; bitsPerPixel = 1; if (image->bitmap_bit_order != MSBFirst) { char *srcPtr = image->data + image->xoffset; char *endPtr = srcPtr + len; char *destPtr = (data = ckalloc(len)); while (srcPtr < endPtr) { *destPtr++ = xBitReverseTable[(unsigned char)(*(srcPtr++))]; } } else { data = memcpy(ckalloc(len), image->data + image->xoffset, len); } if (data) { provider = CGDataProviderCreateWithData(data, data, len, releaseData); } if (provider) { img = CGImageMaskCreate(image->width, image->height, bitsPerComponent, bitsPerPixel, image->bytes_per_line, provider, decode, 0); } } else if (image->format == ZPixmap && image->bits_per_pixel == 32) { /* * Color image */ CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB(); bitsPerComponent = 8; bitsPerPixel = 32; bitmapInfo = (image->byte_order == MSBFirst ? kCGBitmapByteOrder32Big : kCGBitmapByteOrder32Little); if (use_ximage_alpha) { bitmapInfo |= kCGImageAlphaPremultipliedFirst; } else { bitmapInfo |= kCGImageAlphaNoneSkipFirst; } data = memcpy(ckalloc(len), image->data + image->xoffset, len); if (data) { provider = CGDataProviderCreateWithData(data, data, len, releaseData); } if (provider) { img = CGImageCreate(image->width, image->height, bitsPerComponent, bitsPerPixel, image->bytes_per_line, colorspace, bitmapInfo, provider, decode, 0, kCGRenderingIntentDefault); CFRelease(provider); } if (colorspace) { CFRelease(colorspace); } } else { TkMacOSXDbgMsg("Unsupported image type"); } return img; } /* *---------------------------------------------------------------------- * * XGetImage -- * * This function copies data from a pixmap or window into an XImage. * * Results: * Returns a newly allocated XImage containing the data from the given * rectangle of the given drawable, or NULL if the XImage could not be * constructed. NOTE: If we are copying from a window on a Retina * display, the dimensions of the XImage will be 2*width x 2*height. * * Side effects: * None. * *---------------------------------------------------------------------- */ struct pixel_fmt {int r; int g; int b; int a;}; static struct pixel_fmt bgra = {2, 1, 0, 3}; static struct pixel_fmt abgr = {3, 2, 1, 0}; XImage * XGetImage( Display *display, Drawable drawable, int x, int y, unsigned int width, unsigned int height, unsigned long plane_mask, int format) { NSBitmapImageRep* bitmap_rep = NULL; NSUInteger bitmap_fmt = 0; XImage* imagePtr = NULL; char* bitmap = NULL; char R, G, B, A; int depth = 32, offset = 0, bitmap_pad = 0; unsigned int bytes_per_row, size, row, n, m; unsigned int scalefactor=1, scaled_height=height, scaled_width=width; NSWindow *win = TkMacOSXDrawableWindow(drawable); MacDrawable *macDraw = ((MacDrawable*)drawable); static enum {unknown, no, yes} has_retina = unknown; if (win && has_retina == unknown) { #ifdef __clang__ has_retina = [win respondsToSelector:@selector(backingScaleFactor)]? yes : no; #else has_retina = no; #endif } if (has_retina == yes) { /* * We only allow scale factors 1 or 2, as Apple currently does. */ #ifdef __clang__ scalefactor = [win backingScaleFactor] == 2.0 ? 2 : 1; #endif scaled_height *= scalefactor; scaled_width *= scalefactor; } if (format == ZPixmap) { if (width == 0 || height == 0) { return NULL; } bitmap_rep = TkMacOSXBitmapRepFromDrawableRect(drawable, x, y, width, height); if (!bitmap_rep) { TkMacOSXDbgMsg("XGetImage: Failed to construct NSBitmapRep"); return NULL; } bitmap_fmt = [bitmap_rep bitmapFormat]; size = [bitmap_rep bytesPerPlane]; bytes_per_row = [bitmap_rep bytesPerRow]; bitmap = ckalloc(size); if (!bitmap || (bitmap_fmt != 0 && bitmap_fmt != 1) || [bitmap_rep samplesPerPixel] != 4 || [bitmap_rep isPlanar] != 0 || bytes_per_row != 4 * scaled_width || size != bytes_per_row*scaled_height ) { TkMacOSXDbgMsg("XGetImage: Unrecognized bitmap format"); CFRelease(bitmap_rep); return NULL; } if (macDraw->flags & TK_USE_XIMAGE_ALPHA) { /* * When called by TkImgPhotoDisplay we are being asked to return a * background image to be blended with the photoimage using its * alpha channel, if it has one. Returning a black pixmap here * makes TkImgPhotoDisplay create an XImage with a premultiplied * alpha channel, as favored by Apple. When TkImgPhotoDisplay * passes this XImage to TkPutImage, targeting a pixmap, it creates * an image with correct transparency. This is used, for example, * when creating an iconphoto or a menu image from a PNG * photoimage. */ bzero(bitmap, size); } else { memcpy(bitmap, (char *)[bitmap_rep bitmapData], size); } CFRelease(bitmap_rep); /* * When Apple extracts a bitmap from an NSView, it may be in * either BGRA or ABGR format. For an XImage we need RGBA. */ struct pixel_fmt pixel = bitmap_fmt == 0 ? bgra : abgr; for (row=0, n=0; row<scaled_height; row++, n+=bytes_per_row) { for (m=n; m<n+bytes_per_row; m+=4) { R = *(bitmap + m + pixel.r); G = *(bitmap + m + pixel.g); B = *(bitmap + m + pixel.b); A = *(bitmap + m + pixel.a); *(bitmap + m) = R; *(bitmap + m + 1) = G; *(bitmap + m + 2) = B; *(bitmap + m + 3) = A; } } imagePtr = XCreateImage(display, NULL, depth, format, offset, (char*)bitmap, scaled_width, scaled_height, bitmap_pad, bytes_per_row); if (scalefactor == 2) { imagePtr->pixelpower = 1; } } else { /* * There are some calls to XGetImage in the generic Tk * code which pass an XYPixmap rather than a ZPixmap. * XYPixmaps should be handled here. */ TkMacOSXDbgMsg("XGetImage does not handle XYPixmaps at the moment."); } return imagePtr; } /* *---------------------------------------------------------------------- * * DestroyImage -- * * Destroys storage associated with an image. * * Results: * None. * * Side effects: * Deallocates the image. * *---------------------------------------------------------------------- */ static int DestroyImage( XImage *image) { if (image) { if (image->data) { ckfree(image->data); } ckfree(image); } return 0; } /* *---------------------------------------------------------------------- * * ImageGetPixel -- * * Get a single pixel from an image. * * Results: * Returns the 32 bit pixel value. * * Side effects: * None. * *---------------------------------------------------------------------- */ static unsigned long ImageGetPixel( XImage *image, int x, int y) { unsigned char r = 0, g = 0, b = 0; if (image && image->data) { unsigned char *srcPtr = ((unsigned char*) image->data) + (y * image->bytes_per_line) + (((image->xoffset + x) * image->bits_per_pixel) / NBBY); switch (image->bits_per_pixel) { case 32: { r = (*((unsigned int*) srcPtr) >> 16) & 0xff; g = (*((unsigned int*) srcPtr) >> 8) & 0xff; b = (*((unsigned int*) srcPtr) ) & 0xff; /*if (image->byte_order == LSBFirst) { r = srcPtr[2]; g = srcPtr[1]; b = srcPtr[0]; } else { r = srcPtr[1]; g = srcPtr[2]; b = srcPtr[3]; }*/ break; } case 16: r = (*((unsigned short*) srcPtr) >> 7) & 0xf8; g = (*((unsigned short*) srcPtr) >> 2) & 0xf8; b = (*((unsigned short*) srcPtr) << 3) & 0xf8; break; case 8: r = (*srcPtr << 2) & 0xc0; g = (*srcPtr << 4) & 0xc0; b = (*srcPtr << 6) & 0xc0; r |= r >> 2 | r >> 4 | r >> 6; g |= g >> 2 | g >> 4 | g >> 6; b |= b >> 2 | b >> 4 | b >> 6; break; case 4: { unsigned char c = (x % 2) ? *srcPtr : (*srcPtr >> 4); r = (c & 0x04) ? 0xff : 0; g = (c & 0x02) ? 0xff : 0; b = (c & 0x01) ? 0xff : 0; break; } case 1: r = g = b = ((*srcPtr) & (0x80 >> (x % 8))) ? 0xff : 0; break; } } return (PIXEL_MAGIC << 24) | (r << 16) | (g << 8) | b; } /* *---------------------------------------------------------------------- * * ImagePutPixel -- * * Set a single pixel in an image. * * Results: * None. * * Side effects: * None. * *---------------------------------------------------------------------- */ static int ImagePutPixel( XImage *image, int x, int y, unsigned long pixel) { if (image && image->data) { unsigned char *dstPtr = ((unsigned char*) image->data) + (y * image->bytes_per_line) + (((image->xoffset + x) * image->bits_per_pixel) / NBBY); if (image->bits_per_pixel == 32) { *((unsigned int*) dstPtr) = pixel; } else { unsigned char r = ((pixel & image->red_mask) >> 16) & 0xff; unsigned char g = ((pixel & image->green_mask) >> 8) & 0xff; unsigned char b = ((pixel & image->blue_mask) ) & 0xff; switch (image->bits_per_pixel) { case 16: *((unsigned short*) dstPtr) = ((r & 0xf8) << 7) | ((g & 0xf8) << 2) | ((b & 0xf8) >> 3); break; case 8: *dstPtr = ((r & 0xc0) >> 2) | ((g & 0xc0) >> 4) | ((b & 0xc0) >> 6); break; case 4: { unsigned char c = ((r & 0x80) >> 5) | ((g & 0x80) >> 6) | ((b & 0x80) >> 7); *dstPtr = (x % 2) ? ((*dstPtr & 0xf0) | (c & 0x0f)) : ((*dstPtr & 0x0f) | ((c << 4) & 0xf0)); break; } case 1: *dstPtr = ((r|g|b) & 0x80) ? (*dstPtr | (0x80 >> (x % 8))) : (*dstPtr & ~(0x80 >> (x % 8))); break; } } } return 0; } /* *---------------------------------------------------------------------- * * XCreateImage -- * * Allocates storage for a new XImage. * * Results: * Returns a newly allocated XImage. * * Side effects: * None. * *---------------------------------------------------------------------- */ XImage * XCreateImage( Display* display, Visual* visual, unsigned int depth, int format, int offset, char* data, unsigned int width, unsigned int height, int bitmap_pad, int bytes_per_line) { XImage *ximage; display->request++; ximage = ckalloc(sizeof(XImage)); ximage->height = height; ximage->width = width; ximage->depth = depth; ximage->xoffset = offset; ximage->format = format; ximage->data = data; ximage->obdata = NULL; /* The default pixelpower is 0. This must be explicitly set to 1 in the * case of an XImage extracted from a Retina display. */ ximage->pixelpower = 0; if (format == ZPixmap) { ximage->bits_per_pixel = 32; ximage->bitmap_unit = 32; } else { ximage->bits_per_pixel = 1; ximage->bitmap_unit = 8; } if (bitmap_pad) { ximage->bitmap_pad = bitmap_pad; } else { /* Use 16 byte alignment for best Quartz perfomance */ ximage->bitmap_pad = 128; } if (bytes_per_line) { ximage->bytes_per_line = bytes_per_line; } else { ximage->bytes_per_line = ((width * ximage->bits_per_pixel + (ximage->bitmap_pad - 1)) >> 3) & ~((ximage->bitmap_pad >> 3) - 1); } #ifdef WORDS_BIGENDIAN ximage->byte_order = MSBFirst; ximage->bitmap_bit_order = MSBFirst; #else ximage->byte_order = LSBFirst; ximage->bitmap_bit_order = LSBFirst; #endif ximage->red_mask = 0x00FF0000; ximage->green_mask = 0x0000FF00; ximage->blue_mask = 0x000000FF; ximage->f.create_image = NULL; ximage->f.destroy_image = DestroyImage; ximage->f.get_pixel = ImageGetPixel; ximage->f.put_pixel = ImagePutPixel; ximage->f.sub_image = NULL; ximage->f.add_pixel = NULL; return ximage; } /* *---------------------------------------------------------------------- * * TkPutImage -- * * Copies a subimage from an in-memory image to a rectangle of * of the specified drawable. * * Results: * None. * * Side effects: * Draws the image on the specified drawable. * *---------------------------------------------------------------------- */ int TkPutImage( unsigned long *colors, /* Unused on Macintosh. */ int ncolors, /* Unused on Macintosh. */ Display* display, /* Display. */ Drawable drawable, /* Drawable to place image on. */ GC gc, /* GC to use. */ XImage* image, /* Image to place. */ int src_x, /* Source X & Y. */ int src_y, int dest_x, /* Destination X & Y. */ int dest_y, unsigned int width, /* Same width & height for both */ unsigned int height) /* distination and source. */ { TkMacOSXDrawingContext dc; MacDrawable *macDraw = ((MacDrawable*)drawable); display->request++; if (!TkMacOSXSetupDrawingContext(drawable, gc, 1, &dc)) { return BadDrawable; } if (dc.context) { CGImageRef img = TkMacOSXCreateCGImageWithXImage(image, macDraw->flags & TK_USE_XIMAGE_ALPHA); if (img) { /* If the XImage has big pixels, rescale the source dimensions.*/ int pp = image->pixelpower; TkMacOSXDrawCGImage(drawable, gc, dc.context, img, gc->foreground, gc->background, CGRectMake(0, 0, image->width<<pp, image->height<<pp), CGRectMake(src_x<<pp, src_y<<pp, width<<pp, height<<pp), CGRectMake(dest_x, dest_y, width, height)); CFRelease(img); } else { TkMacOSXDbgMsg("Invalid source drawable"); } } else { TkMacOSXDbgMsg("Invalid destination drawable"); } TkMacOSXRestoreDrawingContext(&dc); return Success; } /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
Changes to macosx/tkMacOSXInit.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkMacOSXInit.c -- * * This file contains Mac OS X -specific interpreter initialization * functions. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright 2001-2009, Apple Inc. * Copyright (c) 2005-2009 Daniel A. Steffen <[email protected]> * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /* * tkMacOSXInit.c -- * * This file contains Mac OS X -specific interpreter initialization * functions. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright 2001-2009, Apple Inc. * Copyright (c) 2005-2009 Daniel A. Steffen <[email protected]> * Copyright (c) 2017 Marc Culler * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" |
︙ | ︙ | |||
28 29 30 31 32 33 34 | static char scriptPath[PATH_MAX + 1] = ""; long tkMacOSXMacOSXVersion = 0; #pragma mark TKApplication(TKInit) | < < < < < < < < < < < | > > > > > > | > > > > > > > > > > > > < < < | < < < < | | < < < < < < < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 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 | static char scriptPath[PATH_MAX + 1] = ""; long tkMacOSXMacOSXVersion = 0; #pragma mark TKApplication(TKInit) @interface TKApplication(TKKeyboard) - (void) keyboardChanged: (NSNotification *) notification; @end #define TKApplication_NSApplicationDelegate <NSApplicationDelegate> @interface TKApplication(TKWindowEvent) TKApplication_NSApplicationDelegate - (void) _setupWindowNotifications; @end @interface TKApplication(TKMenus) - (void) _setupMenus; @end @implementation TKApplication @synthesize poolLock = _poolLock; @end /* * #define this to see a message on stderr whenever _resetAutoreleasePool is * called while the pool is locked. */ #undef DEBUG_LOCK @implementation TKApplication(TKInit) - (void) _resetAutoreleasePool { if([self poolLock] == 0) { [_mainPool drain]; _mainPool = [NSAutoreleasePool new]; } else { #ifdef DEBUG_LOCK fprintf(stderr, "Pool is locked with count %d!!!!\n", [self poolLock]); #endif } } - (void) _lockAutoreleasePool { [self setPoolLock:[self poolLock] + 1]; } - (void) _unlockAutoreleasePool { [self setPoolLock:[self poolLock] - 1]; } #ifdef TK_MAC_DEBUG_NOTIFICATIONS - (void) _postedNotification: (NSNotification *) notification { TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); } #endif - (void) _setupApplicationNotifications { NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; #define observe(n, s) \ [nc addObserver:self selector:@selector(s) name:(n) object:nil] observe(NSApplicationDidBecomeActiveNotification, applicationActivate:); observe(NSApplicationDidResignActiveNotification, applicationDeactivate:); observe(NSApplicationDidUnhideNotification, applicationShowHide:); observe(NSApplicationDidHideNotification, applicationShowHide:); observe(NSApplicationDidChangeScreenParametersNotification, displayChanged:); observe(NSTextInputContextKeyboardSelectionDidChangeNotification, keyboardChanged:); #undef observe } -(void)applicationWillFinishLaunching:(NSNotification *)aNotification { /* * Initialize notifications. */ #ifdef TK_MAC_DEBUG_NOTIFICATIONS [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_postedNotification:) name:nil object:nil]; #endif [self _setupWindowNotifications]; [self _setupApplicationNotifications]; /* * Construct the menu bar. */ _defaultMainMenu = nil; [self _setupMenus]; /* * Initialize event processing. */ TkMacOSXInitAppleEvents(_eventInterp); /* * Initialize the graphics context. */ TkMacOSXUseAntialiasedText(_eventInterp, -1); TkMacOSXInitCGDrawing(_eventInterp, TRUE, 0); } -(void)applicationDidFinishLaunching:(NSNotification *)notification { /* * It is not safe to force activation of the NSApp until this * method is called. Activating too early can cause the menu * bar to be unresponsive. */ [NSApp activateIgnoringOtherApps: YES]; } - (void) _setup: (Tcl_Interp *) interp { /* * Remember our interpreter. */ _eventInterp = interp; /* * Install the global autoreleasePool. */ _mainPool = [NSAutoreleasePool new]; [NSApp setPoolLock:0]; /* * Be our own delegate. */ [self setDelegate:self]; /* * Make sure we are allowed to open windows. */ [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; /* * If no icon has been set from an Info.plist file, use the Wish icon from * the Tk framework. */ NSString *iconFile = [[NSBundle mainBundle] objectForInfoDictionaryKey: @"CFBundleIconFile"]; if (!iconFile) { NSString *path = [NSApp tkFrameworkImagePath:@"Tk.icns"]; if (path) { NSImage *image = [[NSImage alloc] initWithContentsOfFile:path]; if (image) { [NSApp setApplicationIconImage:image]; [image release]; } } } } - (NSString *) tkFrameworkImagePath: (NSString *) image { NSString *path = nil; NSAutoreleasePool *pool = [NSAutoreleasePool new]; if (tkLibPath[0] != '\0') { |
︙ | ︙ | |||
159 160 161 162 163 164 165 | @end #pragma mark - /* *---------------------------------------------------------------------- * | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | @end #pragma mark - /* *---------------------------------------------------------------------- * * TkpInit -- * * Performs Mac-specific interpreter initialization related to the * tk_library variable. * * Results: * Returns a standard Tcl result. Leaves an error message or result in |
︙ | ︙ | |||
219 220 221 222 223 224 225 | /* * Since it is possible for TkInit to be called multiple times and we * don't want to do the following initialization multiple times we protect * against doing it more than once. */ if (!initialized) { | < < < | | | 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | /* * Since it is possible for TkInit to be called multiple times and we * don't want to do the following initialization multiple times we protect * against doing it more than once. */ if (!initialized) { struct utsname name; struct stat st; initialized = 1; /* * Initialize/check OS version variable for runtime checks. */ #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 # error Mac OS X 10.6 required #endif if (!uname(&name)) { tkMacOSXMacOSXVersion = (strtod(name.release, NULL) + 96) * 10; } /*Check for new versioning scheme on Yosemite (10.10) and later.*/ if (MAC_OS_X_VERSION_MIN_REQUIRED > 100000) { |
︙ | ︙ | |||
259 260 261 262 263 264 265 266 | * framework scripts directory. * FIXME: Should we come up with a more generic way of doing this? */ if (Tcl_MacOSXOpenVersionedBundleResources(interp, "com.tcltk.tklibrary", TK_FRAMEWORK_VERSION, 0, PATH_MAX, tkLibPath) != TCL_OK) { TkMacOSXDbgMsg("Tcl_MacOSXOpenVersionedBundleResources failed"); | > < | | < < < < < < < < < < < < < | < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < > > > > > > > > > > > > > > > > > > | 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 | * framework scripts directory. * FIXME: Should we come up with a more generic way of doing this? */ if (Tcl_MacOSXOpenVersionedBundleResources(interp, "com.tcltk.tklibrary", TK_FRAMEWORK_VERSION, 0, PATH_MAX, tkLibPath) != TCL_OK) { # if 0 /* This is not really an error. Wish still runs fine. */ TkMacOSXDbgMsg("Tcl_MacOSXOpenVersionedBundleResources failed"); # endif } #endif /* * FIXME: Close stdin & stdout for remote debugging otherwise we will * fight with gdb for stdin & stdout */ if (getenv("XCNOSTDIN") != NULL) { close(0); close(1); } /* * Instantiate our NSApplication object. This needs to be * done before we check whether to open a console window. */ NSAutoreleasePool *pool = [NSAutoreleasePool new]; [[NSUserDefaults standardUserDefaults] registerDefaults: [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:YES], @"_NSCanWrapButtonTitles", [NSNumber numberWithInt:-1], @"NSStringDrawingTypesetterBehavior", nil]]; [TKApplication sharedApplication]; [pool drain]; [NSApp _setup:interp]; [NSApp finishLaunching]; /* * If we don't have a TTY and stdin is a special character file of * length 0, (e.g. /dev/null, which is what Finder sets when double * clicking Wish) then use the Tk based console interpreter. */ if (getenv("TK_CONSOLE") || |
︙ | ︙ | |||
383 384 385 386 387 388 389 390 391 392 393 394 395 396 | TCL_GLOBAL_ONLY); } } if (Tk_CreateConsoleWindow(interp) == TCL_ERROR) { return TCL_ERROR; } } } Tk_MacOSXSetupTkNotifier(); if (tkLibPath[0] != '\0') { Tcl_SetVar2(interp, "tk_library", NULL, tkLibPath, TCL_GLOBAL_ONLY); } | > | 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | TCL_GLOBAL_ONLY); } } if (Tk_CreateConsoleWindow(interp) == TCL_ERROR) { return TCL_ERROR; } } } Tk_MacOSXSetupTkNotifier(); if (tkLibPath[0] != '\0') { Tcl_SetVar2(interp, "tk_library", NULL, tkLibPath, TCL_GLOBAL_ONLY); } |
︙ | ︙ |
Changes to macosx/tkMacOSXInt.h.
︙ | ︙ | |||
83 84 85 86 87 88 89 90 91 92 93 94 95 96 | #define TK_CLIP_INVALID 0x02 #define TK_HOST_EXISTS 0x04 #define TK_DRAWN_UNDER_MENU 0x08 #define TK_FOCUSED_VIEW 0x10 #define TK_IS_PIXMAP 0x20 #define TK_IS_BW_PIXMAP 0x40 #define TK_DO_NOT_DRAW 0x80 /* * I am reserving TK_EMBEDDED = 0x100 in the MacDrawable flags * This is defined in tk.h. We need to duplicate the TK_EMBEDDED flag in the * TkWindow structure for the window, but in the MacWin. This way we can * still tell what the correct port is after the TKWindow structure has been * freed. This actually happens when you bind destroy of a toplevel to * Destroy of a child. | > | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | #define TK_CLIP_INVALID 0x02 #define TK_HOST_EXISTS 0x04 #define TK_DRAWN_UNDER_MENU 0x08 #define TK_FOCUSED_VIEW 0x10 #define TK_IS_PIXMAP 0x20 #define TK_IS_BW_PIXMAP 0x40 #define TK_DO_NOT_DRAW 0x80 #define TK_USE_XIMAGE_ALPHA 0x100 /* * I am reserving TK_EMBEDDED = 0x100 in the MacDrawable flags * This is defined in tk.h. We need to duplicate the TK_EMBEDDED flag in the * TkWindow structure for the window, but in the MacWin. This way we can * still tell what the correct port is after the TKWindow structure has been * freed. This actually happens when you bind destroy of a toplevel to * Destroy of a child. |
︙ | ︙ |
Changes to macosx/tkMacOSXKeyEvent.c.
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXEvent.h" /* #ifdef TK_MAC_DEBUG #define TK_MAC_DEBUG_KEYBOARD #endif */ #define NS_KEYLOG 0 | > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXEvent.h" #include "tkMacOSXConstants.h" /* #ifdef TK_MAC_DEBUG #define TK_MAC_DEBUG_KEYBOARD #endif */ #define NS_KEYLOG 0 |
︙ | ︙ |
Changes to macosx/tkMacOSXKeyboard.c.
︙ | ︙ | |||
9 10 11 12 13 14 15 | * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXEvent.h" | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXEvent.h" #include "tkMacOSXConstants.h" /* * A couple of simple definitions to make code a bit more self-explaining. * * For the assignments of Mod1==meta==command and Mod2==alt==option, see also * tkMacOSXMouseEvent.c. */ |
︙ | ︙ | |||
91 92 93 94 95 96 97 98 99 100 101 102 103 104 | {103, XK_F11}, {111, XK_F12}, {105, XK_F13}, {107, XK_F14}, {113, XK_F15}, {0, 0} }; static int initialized = 0; static Tcl_HashTable keycodeTable; /* keyArray hashed by keycode value. */ static Tcl_HashTable vkeyTable; /* virtualkeyArray hashed by virtual * keycode value. */ static int latin1Table[LATIN1_MAX+1]; /* Reverse mapping table for | > > > > > > > > > > > > > > > > > > | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | {103, XK_F11}, {111, XK_F12}, {105, XK_F13}, {107, XK_F14}, {113, XK_F15}, {0, 0} }; #define NUM_MOD_KEYCODES 14 static KeyCode modKeyArray[NUM_MOD_KEYCODES] = { XK_Shift_L, XK_Shift_R, XK_Control_L, XK_Control_R, XK_Caps_Lock, XK_Shift_Lock, XK_Meta_L, XK_Meta_R, XK_Alt_L, XK_Alt_R, XK_Super_L, XK_Super_R, XK_Hyper_L, XK_Hyper_R, }; static int initialized = 0; static Tcl_HashTable keycodeTable; /* keyArray hashed by keycode value. */ static Tcl_HashTable vkeyTable; /* virtualkeyArray hashed by virtual * keycode value. */ static int latin1Table[LATIN1_MAX+1]; /* Reverse mapping table for |
︙ | ︙ | |||
453 454 455 456 457 458 459 | (void) display; /*unused*/ /* * MacOSX doesn't use the key codes for the modifiers for anything, and we * don't generate them either. So there is no modifier map. */ | < | 471 472 473 474 475 476 477 478 479 480 481 482 483 484 | (void) display; /*unused*/ /* * MacOSX doesn't use the key codes for the modifiers for anything, and we * don't generate them either. So there is no modifier map. */ modmap = ckalloc(sizeof(XModifierKeymap)); modmap->max_keypermod = 0; modmap->modifiermap = NULL; return modmap; } /* |
︙ | ︙ | |||
544 545 546 547 548 549 550 | static int XKeysymToMacKeycode( Display *display, KeySym keysym) { KeyInfo *kPtr; | < | 561 562 563 564 565 566 567 568 569 570 571 572 573 574 | static int XKeysymToMacKeycode( Display *display, KeySym keysym) { KeyInfo *kPtr; if (keysym <= LATIN1_MAX) { /* * Handle keysyms in the Latin-1 range where keysym and Unicode * character code point are the same. */ if (keyboardChanged) { |
︙ | ︙ | |||
574 575 576 577 578 579 580 581 582 583 584 585 586 587 | } } for (kPtr = virtualkeyArray; kPtr->keycode != 0; kPtr++) { if (kPtr->keysym == keysym) { return kPtr->keycode; } } /* * For other keysyms (not Latin-1 and not special keys), we'd need a * generic keysym-to-unicode table. We don't have that, so we give up here. */ return 0; | > > > > > > > > > > > | 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 | } } for (kPtr = virtualkeyArray; kPtr->keycode != 0; kPtr++) { if (kPtr->keysym == keysym) { return kPtr->keycode; } } /* * Modifier keycodes only come from generated events. No translation * is needed. */ for (int i=0; i < NUM_MOD_KEYCODES; i++) { if (keysym == modKeyArray[i]) { return keysym; } } /* * For other keysyms (not Latin-1 and not special keys), we'd need a * generic keysym-to-unicode table. We don't have that, so we give up here. */ return 0; |
︙ | ︙ | |||
657 658 659 660 661 662 663 664 665 666 667 668 669 670 | TkpSetKeycodeAndState( Tk_Window tkwin, KeySym keysym, XEvent *eventPtr) { if (keysym == NoSymbol) { eventPtr->xkey.keycode = 0; } else { Display *display = Tk_Display(tkwin); int macKeycode = XKeysymToMacKeycode(display, keysym); /* * See also XKeysymToKeycode. */ | > > > > > > > < | 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 | TkpSetKeycodeAndState( Tk_Window tkwin, KeySym keysym, XEvent *eventPtr) { if (keysym == NoSymbol) { eventPtr->xkey.keycode = 0; } else if ( modKeyArray[0] <= keysym && keysym <= modKeyArray[NUM_MOD_KEYCODES - 1]) { /* * Keysyms for pure modifiers only arise in generated events. * We should just copy them to the keycode. */ eventPtr->xkey.keycode = keysym; } else { Display *display = Tk_Display(tkwin); int macKeycode = XKeysymToMacKeycode(display, keysym); /* * See also XKeysymToKeycode. */ if ((keysym >= XK_F1) && (keysym <= XK_F35)) { eventPtr->xkey.keycode = 0x0010; } else { eventPtr->xkey.keycode = 0x00FF & keysym; } eventPtr->xkey.keycode |= (macKeycode & MAC_KEYCODE_MASK) << 16; |
︙ | ︙ | |||
730 731 732 733 734 735 736 | /* * Handle pure modifier keys specially. We use -1 as a signal for * this. */ if (eventPtr->xany.send_event == -1) { | < | 763 764 765 766 767 768 769 770 771 772 773 774 775 776 | /* * Handle pure modifier keys specially. We use -1 as a signal for * this. */ if (eventPtr->xany.send_event == -1) { int modifier = eventPtr->xkey.keycode & NSDeviceIndependentModifierFlagsMask; if (modifier == NSCommandKeyMask) { return XK_Meta_L; } else if (modifier == NSShiftKeyMask) { return XK_Shift_L; } else if (modifier == NSAlphaShiftKeyMask) { |
︙ | ︙ | |||
887 888 889 890 891 892 893 | dispPtr->metaModMask = COMMAND_MASK; #else dispPtr->altModMask = 0; dispPtr->metaModMask = 0; #endif /* | | | | | < | > > | > | 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 | dispPtr->metaModMask = COMMAND_MASK; #else dispPtr->altModMask = 0; dispPtr->metaModMask = 0; #endif /* * MacOSX doesn't create a key event when a modifier key is pressed or * released. However, it is possible to generate key events for * modifier keys, and this is done in the tests. So we construct an array * containing the keycodes of the standard modifier keys from static data. */ if (dispPtr->modKeyCodes != NULL) { ckfree(dispPtr->modKeyCodes); } dispPtr->numModKeyCodes = NUM_MOD_KEYCODES; dispPtr->modKeyCodes = (KeyCode *)ckalloc(NUM_MOD_KEYCODES * sizeof(KeyCode)); for (int i = 0; i < NUM_MOD_KEYCODES; i++) { dispPtr->modKeyCodes[i] = modKeyArray[i]; } } /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
Changes to macosx/tkMacOSXMenu.c.
︙ | ︙ | |||
15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #include "tkMacOSXPrivate.h" #include "tkMenubutton.h" #include "tkMenu.h" #include "tkColor.h" #include "tkFont.h" #include "tkMacOSXWm.h" #include "tkMacOSXDebug.h" /* #ifdef TK_MAC_DEBUG #define TK_MAC_DEBUG_MENUS #endif */ | > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #include "tkMacOSXPrivate.h" #include "tkMenubutton.h" #include "tkMenu.h" #include "tkColor.h" #include "tkFont.h" #include "tkMacOSXWm.h" #include "tkMacOSXDebug.h" #include "tkMacOSXConstants.h" /* #ifdef TK_MAC_DEBUG #define TK_MAC_DEBUG_MENUS #endif */ |
︙ | ︙ | |||
112 113 114 115 116 117 118 | @interface TKMenu(TKMenuPrivate) - (id) initWithTkMenu: (TkMenu *) tkMenu; - (TkMenu *) tkMenu; - (int) tkIndexOfItem: (NSMenuItem *) menuItem; - (void) insertItem: (NSMenuItem *) newItem atTkIndex: (NSInteger) index; @end | < < < < | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | @interface TKMenu(TKMenuPrivate) - (id) initWithTkMenu: (TkMenu *) tkMenu; - (TkMenu *) tkMenu; - (int) tkIndexOfItem: (NSMenuItem *) menuItem; - (void) insertItem: (NSMenuItem *) newItem atTkIndex: (NSInteger) index; @end #define TKMenu_NSMenuDelegate <NSMenuDelegate> @interface TKMenu(TKMenuDelegate) TKMenu_NSMenuDelegate @end @implementation TKMenu - (void) setSpecial: (NSUInteger) special { NSAssert(!_tkSpecial, @"Cannot change specialness of a special menu"); |
︙ | ︙ | |||
769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 | if (root == NULL) { return TCL_ERROR; } Drawable d = Tk_WindowId(root); NSView *rootview = TkMacOSXGetRootControl(d); NSWindow *win = [rootview window]; inPostMenu = 1; int oldMode = Tcl_SetServiceMode(TCL_SERVICE_NONE); NSView *view = [win contentView]; NSRect frame = NSMakeRect(x + 9, tkMacOSXZeroScreenHeight - y - 9, 1, 1); frame.origin = [view convertPoint: [win convertPointFromScreen:frame.origin] fromView:nil]; | > > > > > > > | 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 | if (root == NULL) { return TCL_ERROR; } Drawable d = Tk_WindowId(root); NSView *rootview = TkMacOSXGetRootControl(d); NSWindow *win = [rootview window]; int result; inPostMenu = 1; result = TkPreprocessMenu(menuPtr); if (result != TCL_OK) { inPostMenu = 0; return result; } int oldMode = Tcl_SetServiceMode(TCL_SERVICE_NONE); NSView *view = [win contentView]; NSRect frame = NSMakeRect(x + 9, tkMacOSXZeroScreenHeight - y - 9, 1, 1); frame.origin = [view convertPoint: [win convertPointFromScreen:frame.origin] fromView:nil]; |
︙ | ︙ |
Changes to macosx/tkMacOSXMenus.c.
︙ | ︙ | |||
9 10 11 12 13 14 15 16 17 18 19 20 21 22 | * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMenu.h" static void GenerateEditEvent(const char *name); static Tcl_Obj * GetWidgetDemoPath(Tcl_Interp *interp); #pragma mark TKApplication(TKMenus) @implementation TKApplication(TKMenus) | > | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMenu.h" #include "tkMacOSXConstants.h" static void GenerateEditEvent(const char *name); static Tcl_Obj * GetWidgetDemoPath(Tcl_Interp *interp); #pragma mark TKApplication(TKMenus) @implementation TKApplication(TKMenus) |
︙ | ︙ |
Changes to macosx/tkMacOSXMouseEvent.c.
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXWm.h" #include "tkMacOSXEvent.h" #include "tkMacOSXDebug.h" typedef struct { unsigned int state; long delta; Window window; Point global; Point local; | > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXWm.h" #include "tkMacOSXEvent.h" #include "tkMacOSXDebug.h" #include "tkMacOSXConstants.h" typedef struct { unsigned int state; long delta; Window window; Point global; Point local; |
︙ | ︙ |
Changes to macosx/tkMacOSXNotify.c.
︙ | ︙ | |||
11 12 13 14 15 16 17 | * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXEvent.h" | | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXEvent.h" #include "tkMacOSXConstants.h" #include <tclInt.h> #import <objc/objc-auto.h> /* This is not used for anything at the moment. */ typedef struct ThreadSpecificData { int initialized; } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; |
︙ | ︙ | |||
136 137 138 139 140 141 142 | tsdPtr->initialized = 1; /* * Install TkAqua event source in main event loop thread. */ if (CFRunLoopGetMain() == CFRunLoopGetCurrent()) { | | | | 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 | tsdPtr->initialized = 1; /* * Install TkAqua event source in main event loop thread. */ if (CFRunLoopGetMain() == CFRunLoopGetCurrent()) { if (![NSThread isMainThread]) { /* * Panic if main runloop is not on the main application thread. */ Tcl_Panic("Tk_MacOSXSetupTkNotifier: %s", "first [load] of TkAqua has to occur in the main thread!"); } Tcl_CreateEventSource(TkMacOSXEventsSetupProc, TkMacOSXEventsCheckProc, NULL); TkCreateExitHandler(TkMacOSXNotifyExitHandler, NULL); Tcl_SetServiceMode(TCL_SERVICE_ALL); TclMacOSXNotifierAddRunLoopMode(NSEventTrackingRunLoopMode); TclMacOSXNotifierAddRunLoopMode(NSModalPanelRunLoopMode); } } } |
︙ | ︙ | |||
180 181 182 183 184 185 186 | TkMacOSXNotifyExitHandler( ClientData clientData) /* Not used. */ { TSD_INIT(); Tcl_DeleteEventSource(TkMacOSXEventsSetupProc, TkMacOSXEventsCheckProc, | | | 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | TkMacOSXNotifyExitHandler( ClientData clientData) /* Not used. */ { TSD_INIT(); Tcl_DeleteEventSource(TkMacOSXEventsSetupProc, TkMacOSXEventsCheckProc, NULL); tsdPtr->initialized = 0; } /* *---------------------------------------------------------------------- * * TkMacOSXEventsSetupProc -- |
︙ | ︙ | |||
212 213 214 215 216 217 218 | static void TkMacOSXEventsSetupProc( ClientData clientData, int flags) { NSString *runloopMode = [[NSRunLoop currentRunLoop] currentMode]; | | > | 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | static void TkMacOSXEventsSetupProc( ClientData clientData, int flags) { NSString *runloopMode = [[NSRunLoop currentRunLoop] currentMode]; /* runloopMode will be nil if we are in a Tcl event loop. */ if (flags & TCL_WINDOW_EVENTS && !runloopMode) { static const Tcl_Time zeroBlockTime = { 0, 0 }; [NSApp _resetAutoreleasePool]; /* Call this with dequeue=NO -- just checking if the queue is empty. */ NSEvent *currentEvent = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:GetRunLoopMode(TkMacOSXGetModalSession()) dequeue:NO]; if (currentEvent) { if (currentEvent.type > 0) { |
︙ | ︙ | |||
252 253 254 255 256 257 258 | */ static void TkMacOSXEventsCheckProc( ClientData clientData, int flags) { NSString *runloopMode = [[NSRunLoop currentRunLoop] currentMode]; | | | > > > > > > < | < < < < < < | 253 254 255 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 | */ static void TkMacOSXEventsCheckProc( ClientData clientData, int flags) { NSString *runloopMode = [[NSRunLoop currentRunLoop] currentMode]; /* runloopMode will be nil if we are in a Tcl event loop. */ if (flags & TCL_WINDOW_EVENTS && !runloopMode) { NSEvent *currentEvent = nil; NSEvent *testEvent = nil; NSModalSession modalSession; /* It is possible for the SetupProc to be called before this function * returns. This happens, for example, when we process an event which * opens a modal window. To prevent premature release of our * application-wide autorelease pool by a nested call to the SetupProc, * we must lock it here. */ [NSApp _lockAutoreleasePool]; do { modalSession = TkMacOSXGetModalSession(); testEvent = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:GetRunLoopMode(modalSession) dequeue:NO]; /* We must not steal any events during LiveResize. */ if (testEvent && [[testEvent window] inLiveResize]) { break; } currentEvent = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:GetRunLoopMode(modalSession) dequeue:YES]; if (currentEvent) { /* Generate Xevents. */ int oldServiceMode = Tcl_SetServiceMode(TCL_SERVICE_ALL); |
︙ | ︙ | |||
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | } } [currentEvent release]; } else { break; } } while (1); } } /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ | > > | 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | } } [currentEvent release]; } else { break; } } while (1); /* Now we can unlock the pool. */ [NSApp _unlockAutoreleasePool]; } } /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
Changes to macosx/tkMacOSXPrivate.h.
︙ | ︙ | |||
55 56 57 58 59 60 61 | if ((chk) && (cond)) { __VA_ARGS__ #define tk_else_mac_os_x_chk(...) \ } else { __VA_ARGS__ #define tk_if_mac_os_x_no(chk, cond, ...) \ if (0) { #define tk_else_mac_os_x_no(...) \ } else { __VA_ARGS__ | < < < < < < < < < < < < < < < < < < < < < | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | if ((chk) && (cond)) { __VA_ARGS__ #define tk_else_mac_os_x_chk(...) \ } else { __VA_ARGS__ #define tk_if_mac_os_x_no(chk, cond, ...) \ if (0) { #define tk_else_mac_os_x_no(...) \ } else { __VA_ARGS__ /* * Macros for DEBUG_ASSERT_MESSAGE et al from Debugging.h. */ #undef kComponentSignatureString #undef COMPONENT_SIGNATURE |
︙ | ︙ | |||
205 206 207 208 209 210 211 | int antiAlias); MODULE_SCOPE int TkMacOSXGenerateFocusEvent(TkWindow *winPtr, int activeFlag); MODULE_SCOPE WindowClass TkMacOSXWindowClass(TkWindow *winPtr); MODULE_SCOPE int TkMacOSXIsWindowZoomed(TkWindow *winPtr); MODULE_SCOPE int TkGenerateButtonEventForXPointer(Window window); MODULE_SCOPE EventModifiers TkMacOSXModifierState(void); | | > > > > > > > | 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 | int antiAlias); MODULE_SCOPE int TkMacOSXGenerateFocusEvent(TkWindow *winPtr, int activeFlag); MODULE_SCOPE WindowClass TkMacOSXWindowClass(TkWindow *winPtr); MODULE_SCOPE int TkMacOSXIsWindowZoomed(TkWindow *winPtr); MODULE_SCOPE int TkGenerateButtonEventForXPointer(Window window); MODULE_SCOPE EventModifiers TkMacOSXModifierState(void); MODULE_SCOPE NSBitmapImageRep* TkMacOSXBitmapRepFromDrawableRect(Drawable drawable, int x, int y, unsigned int width, unsigned int height); MODULE_SCOPE CGImageRef TkMacOSXCreateCGImageWithXImage(XImage *image, int use_ximage_alpha); MODULE_SCOPE void TkMacOSXDrawCGImage(Drawable d, GC gc, CGContextRef context, CGImageRef image, unsigned long imageForeground, unsigned long imageBackground, CGRect imageBounds, CGRect srcBounds, CGRect dstBounds); MODULE_SCOPE int TkMacOSXSetupDrawingContext(Drawable d, GC gc, int useCG, TkMacOSXDrawingContext *dcPtr); MODULE_SCOPE void TkMacOSXRestoreDrawingContext( TkMacOSXDrawingContext *dcPtr); MODULE_SCOPE void TkMacOSXSetColorInContext(GC gc, unsigned long pixel, CGContextRef context); MODULE_SCOPE int TkMacOSXMakeFullscreen(TkWindow *winPtr, NSWindow *window, int fullscreen, Tcl_Interp *interp); MODULE_SCOPE void TkMacOSXEnterExitFullscreen(TkWindow *winPtr, int active); MODULE_SCOPE NSWindow* TkMacOSXDrawableWindow(Drawable drawable); MODULE_SCOPE NSView* TkMacOSXDrawableView(MacDrawable *macWin); MODULE_SCOPE void TkMacOSXWinCGBounds(TkWindow *winPtr, CGRect *bounds); MODULE_SCOPE HIShapeRef TkMacOSXGetClipRgn(Drawable drawable); MODULE_SCOPE void TkMacOSXInvalidateViewRegion(NSView *view, HIShapeRef rgn); MODULE_SCOPE CGContextRef TkMacOSXGetCGContextForDrawable(Drawable drawable); MODULE_SCOPE CGImageRef TkMacOSXCreateCGImageWithDrawable(Drawable drawable); MODULE_SCOPE NSImage* TkMacOSXGetNSImageWithTkImage(Display *display, Tk_Image image, int width, int height); MODULE_SCOPE NSImage* TkMacOSXGetNSImageWithBitmap(Display *display, Pixmap bitmap, GC gc, int width, int height); MODULE_SCOPE CGColorRef TkMacOSXCreateCGColor(GC gc, unsigned long pixel); MODULE_SCOPE NSColor* TkMacOSXGetNSColor(GC gc, unsigned long pixel); |
︙ | ︙ | |||
274 275 276 277 278 279 280 | TKMenu *_defaultMainMenu, *_defaultApplicationMenu; NSArray *_defaultApplicationMenuItems, *_defaultWindowsMenuItems; NSArray *_defaultHelpMenuItems; NSWindow *_windowWithMouse; NSAutoreleasePool *_mainPool; #ifdef __i386__ /* The Objective C runtime used on i386 requires this. */ | | | > > > | 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 | TKMenu *_defaultMainMenu, *_defaultApplicationMenu; NSArray *_defaultApplicationMenuItems, *_defaultWindowsMenuItems; NSArray *_defaultHelpMenuItems; NSWindow *_windowWithMouse; NSAutoreleasePool *_mainPool; #ifdef __i386__ /* The Objective C runtime used on i386 requires this. */ int _poolLock; #endif } @property int poolLock; @end @interface TKApplication(TKInit) - (NSString *)tkFrameworkImagePath:(NSString*)image; - (void)_resetAutoreleasePool; - (void)_lockAutoreleasePool; - (void)_unlockAutoreleasePool; @end @interface TKApplication(TKEvent) - (NSEvent *)tkProcessEvent:(NSEvent *)theEvent; @end @interface TKApplication(TKMouseEvent) - (NSEvent *)tkProcessMouseEvent:(NSEvent *)theEvent; @end |
︙ | ︙ | |||
337 338 339 340 341 342 343 | @interface TKContentView(TKKeyEvent) - (void) deleteWorkingText; @end @interface TKContentView(TKWindowEvent) - (void) drawRect: (NSRect) rect; - (void) generateExposeEvents: (HIShapeRef) shape; | < | 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | @interface TKContentView(TKKeyEvent) - (void) deleteWorkingText; @end @interface TKContentView(TKWindowEvent) - (void) drawRect: (NSRect) rect; - (void) generateExposeEvents: (HIShapeRef) shape; - (void) viewDidEndLiveResize; - (void) tkToolbarButton: (id) sender; - (BOOL) isOpaque; - (BOOL) wantsDefaultClipping; - (BOOL) acceptsFirstResponder; - (void) keyDown: (NSEvent *) theEvent; @end |
︙ | ︙ |
Changes to macosx/tkMacOSXScale.c.
︙ | ︙ | |||
167 168 169 170 171 172 173 | /* * Invoke the scale's command if needed. */ Tcl_Preserve((ClientData) scalePtr); if ((scalePtr->flags & INVOKE_COMMAND) && (scalePtr->command != NULL)) { Tcl_Preserve((ClientData) interp); | > | > > | 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | /* * Invoke the scale's command if needed. */ Tcl_Preserve((ClientData) scalePtr); if ((scalePtr->flags & INVOKE_COMMAND) && (scalePtr->command != NULL)) { Tcl_Preserve((ClientData) interp); if (snprintf(string, TCL_DOUBLE_SPACE, scalePtr->format, scalePtr->value) < 0) { string[TCL_DOUBLE_SPACE - 1] = '\0'; } Tcl_DStringInit(&buf); Tcl_DStringAppend(&buf, scalePtr->command, -1); Tcl_DStringAppend(&buf, " ", -1); Tcl_DStringAppend(&buf, string, -1); result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, 0); Tcl_DStringFree(&buf); if (result != TCL_OK) { |
︙ | ︙ |
Changes to macosx/tkMacOSXSubwindows.c.
︙ | ︙ | |||
145 146 147 148 149 150 151 | } display->request++; macWin->winPtr->flags |= TK_MAPPED; if (Tk_IsTopLevel(macWin->winPtr)) { if (!Tk_IsEmbedded(macWin->winPtr)) { NSWindow *win = TkMacOSXDrawableWindow(window); | > > > > > > > > | > > > > > > > > | > | 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 | } display->request++; macWin->winPtr->flags |= TK_MAPPED; if (Tk_IsTopLevel(macWin->winPtr)) { if (!Tk_IsEmbedded(macWin->winPtr)) { NSWindow *win = TkMacOSXDrawableWindow(window); /* * We want to activate Tk when a toplevel is mapped * but we must not supply YES here. This is because * during Tk initialization the root window is mapped * before applicationDidFinishLaunching returns. Forcing * the app to activate too early can make the menu bar * unresponsive. */ [NSApp activateIgnoringOtherApps:NO]; if ( [win canBecomeKeyWindow] ) { [win makeKeyAndOrderFront:NSApp]; } TkMacOSXApplyWindowAttributes(macWin->winPtr, win); } else { /* * Rebuild the container's clipping region and display * the window. */ TkWindow *contWinPtr = TkpGetOtherWindow(macWin->winPtr); TkMacOSXInvalClipRgns((Tk_Window)contWinPtr); TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW); } TkMacOSXInvalClipRgns((Tk_Window) macWin->winPtr); /* * We only need to send the MapNotify event for toplevel windows. */ event.xany.serial = LastKnownRequestProcessed(display); event.xany.send_event = False; event.xany.display = display; event.xmap.window = window; event.xmap.type = MapNotify; event.xmap.event = window; event.xmap.override_redirect = macWin->winPtr->atts.override_redirect; Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL); } else { /* * Rebuild the parent's clipping region and display the window. * */ TkMacOSXInvalClipRgns((Tk_Window) macWin->winPtr->parentPtr); TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW); } /* |
︙ | ︙ | |||
243 244 245 246 247 248 249 250 251 252 | void XUnmapWindow( Display *display, /* Display. */ Window window) /* Window. */ { MacDrawable *macWin = (MacDrawable *) window; XEvent event; display->request++; | > > < | | | | | > > > > | < | > > | 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 | void XUnmapWindow( Display *display, /* Display. */ Window window) /* Window. */ { MacDrawable *macWin = (MacDrawable *) window; TkWindow *winPtr = macWin->winPtr; TkWindow *parentPtr = winPtr->parentPtr; XEvent event; display->request++; if (Tk_IsTopLevel(winPtr)) { if (!Tk_IsEmbedded(winPtr) && winPtr->wmInfoPtr->hints.initial_state!=IconicState) { NSWindow *win = TkMacOSXDrawableWindow(window); if ([win isVisible]) { [[win parentWindow] removeChildWindow:win]; [win orderOut:NSApp]; } } TkMacOSXInvalClipRgns((Tk_Window) winPtr); /* * We only need to send the UnmapNotify event for toplevel windows. */ event.xany.serial = LastKnownRequestProcessed(display); event.xany.send_event = False; event.xany.display = display; event.xunmap.type = UnmapNotify; event.xunmap.window = window; event.xunmap.event = window; event.xunmap.from_configure = false; Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL); } else { /* * Rebuild the visRgn clip region for the parent so it will be allowed * to draw in the space from which this subwindow was removed. */ if (parentPtr && parentPtr->privatePtr->visRgn) { TkMacOSXInvalidateViewRegion(TkMacOSXDrawableView(parentPtr->privatePtr), parentPtr->privatePtr->visRgn); } TkMacOSXInvalClipRgns((Tk_Window) parentPtr); TkMacOSXUpdateClipRgn(parentPtr); } winPtr->flags &= ~TK_MAPPED; } /* *---------------------------------------------------------------------- * * XResizeWindow -- * |
︙ | ︙ | |||
765 766 767 768 769 770 771 | * the stacking order. For an embedded toplevel, just clip to the * container's visible clip region. Remember, we only allow one * contained window in a frame, and don't support any other widgets * in the frame either. This is not currently enforced, however. */ if (!Tk_IsTopLevel(winPtr)) { | | | | 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 | * the stacking order. For an embedded toplevel, just clip to the * container's visible clip region. Remember, we only allow one * contained window in a frame, and don't support any other widgets * in the frame either. This is not currently enforced, however. */ if (!Tk_IsTopLevel(winPtr)) { if (winPtr->parentPtr) { TkMacOSXUpdateClipRgn(winPtr->parentPtr); ChkErr(HIShapeIntersect, winPtr->parentPtr->privatePtr->aboveVisRgn, rgn, rgn); } win2Ptr = winPtr; while ((win2Ptr = win2Ptr->nextPtr)) { if (Tk_IsTopLevel(win2Ptr) || !Tk_IsMapped(win2Ptr)) { |
︙ | ︙ |
Changes to macosx/tkMacOSXWindowEvent.c.
︙ | ︙ | |||
13 14 15 16 17 18 19 20 21 22 23 24 25 26 | * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXWm.h" #include "tkMacOSXEvent.h" #include "tkMacOSXDebug.h" /* #ifdef TK_MAC_DEBUG #define TK_MAC_DEBUG_EVENTS #define TK_MAC_DEBUG_DRAWING #endif */ | > | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXWm.h" #include "tkMacOSXEvent.h" #include "tkMacOSXDebug.h" #include "tkMacOSXConstants.h" /* #ifdef TK_MAC_DEBUG #define TK_MAC_DEBUG_EVENTS #define TK_MAC_DEBUG_DRAWING #endif */ |
︙ | ︙ | |||
37 38 39 40 41 42 43 | #pragma mark TKApplication(TKWindowEvent) #ifdef TK_MAC_DEBUG_NOTIFICATIONS extern NSString *NSWindowWillOrderOnScreenNotification; extern NSString *NSWindowDidOrderOnScreenNotification; extern NSString *NSWindowDidOrderOffScreenNotification; | < < < < < | < | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | #pragma mark TKApplication(TKWindowEvent) #ifdef TK_MAC_DEBUG_NOTIFICATIONS extern NSString *NSWindowWillOrderOnScreenNotification; extern NSString *NSWindowDidOrderOnScreenNotification; extern NSString *NSWindowDidOrderOffScreenNotification; #endif @implementation TKApplication(TKWindowEvent) - (void) windowActivation: (NSNotification *) notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); |
︙ | ︙ | |||
353 354 355 356 357 358 359 | CFRelease(boundsRgn); event.xany.serial = LastKnownRequestProcessed(Tk_Display(winPtr)); event.xany.send_event = false; event.xany.window = Tk_WindowId(winPtr); event.xany.display = Tk_Display(winPtr); event.type = Expose; | | | | | 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | CFRelease(boundsRgn); event.xany.serial = LastKnownRequestProcessed(Tk_Display(winPtr)); event.xany.send_event = false; event.xany.window = Tk_WindowId(winPtr); event.xany.display = Tk_Display(winPtr); event.type = Expose; event.xexpose.x = damageBounds.origin.x - bounds.origin.x; event.xexpose.y = damageBounds.origin.y - bounds.origin.y; event.xexpose.width = damageBounds.size.width; event.xexpose.height = damageBounds.size.height; event.xexpose.count = 0; Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL); #ifdef TK_MAC_DEBUG_DRAWING NSLog(@"Expose %p {{%d, %d}, {%d, %d}}", event.xany.window, event.xexpose.x, event.xexpose.y, event.xexpose.width, event.xexpose.height); #endif /* |
︙ | ︙ | |||
745 746 747 748 749 750 751 | * *---------------------------------------------------------------------- */ int Tk_MacOSXIsAppInFront(void) { | < < < < < < < < | < < | 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 | * *---------------------------------------------------------------------- */ int Tk_MacOSXIsAppInFront(void) { return ([NSRunningApplication currentApplication].active == true); } #pragma mark TKContentView #import <ApplicationServices/ApplicationServices.h> /* |
︙ | ︙ | |||
854 855 856 857 858 859 860 | ClientData oldArg; Tk_RestrictProc *oldProc; /* This can be called from outside the Tk event loop. * Since it calls Tcl_DoOneEvent, we need to make sure we * don't clobber the AutoreleasePool set up by the caller. */ | | | 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 | ClientData oldArg; Tk_RestrictProc *oldProc; /* This can be called from outside the Tk event loop. * Since it calls Tcl_DoOneEvent, we need to make sure we * don't clobber the AutoreleasePool set up by the caller. */ [NSApp _lockAutoreleasePool]; /* * Try to prevent flickers and flashes. */ [w disableFlushWindow]; NSDisableScreenUpdates(); |
︙ | ︙ | |||
885 886 887 888 889 890 891 | HIRect bounds = NSRectToCGRect([self bounds]); HIShapeRef shape = HIShapeCreateWithRect(&bounds); [self generateExposeEvents: shape]; while (Tk_DoOneEvent(TK_ALL_EVENTS|TK_DONT_WAIT)) {} [w enableFlushWindow]; [w flushWindowIfNeeded]; NSEnableScreenUpdates(); | | | 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 | HIRect bounds = NSRectToCGRect([self bounds]); HIShapeRef shape = HIShapeCreateWithRect(&bounds); [self generateExposeEvents: shape]; while (Tk_DoOneEvent(TK_ALL_EVENTS|TK_DONT_WAIT)) {} [w enableFlushWindow]; [w flushWindowIfNeeded]; NSEnableScreenUpdates(); [NSApp _unlockAutoreleasePool]; } } /* * As insurance against bugs that might cause layout glitches during a live * resize, we redraw the window one more time at the end of the resize * operation. |
︙ | ︙ | |||
910 911 912 913 914 915 916 | /* Core method of this class: generates expose events for redrawing. If the * Tcl_ServiceMode is set to TCL_SERVICE_ALL then the expose events will be * immediately removed from the Tcl event loop and processed. Typically, they * should be queued, however. */ - (void) generateExposeEvents: (HIShapeRef) shape { | < < < < < < < > | 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 | /* Core method of this class: generates expose events for redrawing. If the * Tcl_ServiceMode is set to TCL_SERVICE_ALL then the expose events will be * immediately removed from the Tcl event loop and processed. Typically, they * should be queued, however. */ - (void) generateExposeEvents: (HIShapeRef) shape { unsigned long serial; CGRect updateBounds; int updatesNeeded; TkWindow *winPtr = TkMacOSXGetTkWindow([self window]); if (!winPtr) { return; } /* Generate Tk Expose events. */ HIShapeGetBounds(shape, &updateBounds); |
︙ | ︙ | |||
975 976 977 978 979 980 981 | Tk_QueueWindowEvent((XEvent *) &event, TCL_QUEUE_TAIL); } - (BOOL) isOpaque { NSWindow *w = [self window]; | < < < < | < | 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 | Tk_QueueWindowEvent((XEvent *) &event, TCL_QUEUE_TAIL); } - (BOOL) isOpaque { NSWindow *w = [self window]; return (w && (([w styleMask] & NSTexturedBackgroundWindowMask) || ![w isOpaque]) ? NO : YES); } - (BOOL) wantsDefaultClipping { return NO; } |
︙ | ︙ |
Changes to macosx/tkMacOSXWm.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | /* * tkMacOSXWm.c -- * * This module takes care of the interactions between a Tk-based * application and the window manager. Among other things, it implements * the "wm" command and passes geometry information to the window * manager. * * Copyright (c) 1994-1997 Sun Microsystems, Inc. * Copyright 2001-2009, Apple Inc. * Copyright (c) 2006-2009 Daniel A. Steffen <[email protected]> * Copyright (c) 2010 Kevin Walzer/WordTech Communications LLC. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkScrollbar.h" #include "tkMacOSXWm.h" #include "tkMacOSXEvent.h" #include "tkMacOSXDebug.h" #define DEBUG_ZOMBIES 0 /* #ifdef TK_MAC_DEBUG #define TK_MAC_DEBUG_WINDOWS #endif | > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | /* * tkMacOSXWm.c -- * * This module takes care of the interactions between a Tk-based * application and the window manager. Among other things, it implements * the "wm" command and passes geometry information to the window * manager. * * Copyright (c) 1994-1997 Sun Microsystems, Inc. * Copyright 2001-2009, Apple Inc. * Copyright (c) 2006-2009 Daniel A. Steffen <[email protected]> * Copyright (c) 2010 Kevin Walzer/WordTech Communications LLC. * Copyright (c) 2017 Marc Culler. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkScrollbar.h" #include "tkMacOSXWm.h" #include "tkMacOSXEvent.h" #include "tkMacOSXDebug.h" #include "tkMacOSXConstants.h" #define DEBUG_ZOMBIES 0 /* #ifdef TK_MAC_DEBUG #define TK_MAC_DEBUG_WINDOWS #endif |
︙ | ︙ | |||
49 50 51 52 53 54 55 | | kWindowHideOnFullScreenAttribute | kWindowNoConstrainAttribute \ | kWindowNoShadowAttribute | kWindowLiveResizeAttribute \ | kWindowOpaqueForEventsAttribute | kWindowIgnoreClicksAttribute \ | kWindowDoesNotCycleAttribute | tkWindowDoesNotHideAttribute \ | tkCanJoinAllSpacesAttribute | tkMoveToActiveSpaceAttribute \ | tkNonactivatingPanelAttribute | tkHUDWindowAttribute) | < < < | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | | kWindowHideOnFullScreenAttribute | kWindowNoConstrainAttribute \ | kWindowNoShadowAttribute | kWindowLiveResizeAttribute \ | kWindowOpaqueForEventsAttribute | kWindowIgnoreClicksAttribute \ | kWindowDoesNotCycleAttribute | tkWindowDoesNotHideAttribute \ | tkCanJoinAllSpacesAttribute | tkMoveToActiveSpaceAttribute \ | tkNonactivatingPanelAttribute | tkHUDWindowAttribute) static const struct { const UInt64 validAttrs, defaultAttrs, forceOnAttrs, forceOffAttrs; int flags; NSUInteger styleMask; } macClassAttrs[] = { [kAlertWindowClass] = { .defaultAttrs = kWindowDoesNotCycleAttribute, }, |
︙ | ︙ | |||
193 194 195 196 197 198 199 | * Hash table for Mac Window -> TkWindow mapping. */ static Tcl_HashTable windowTable; static int windowHashInit = false; | < < | > | | 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 | * Hash table for Mac Window -> TkWindow mapping. */ static Tcl_HashTable windowTable; static int windowHashInit = false; #pragma mark NSWindow(TKWm) /* * Conversion of coordinates between window and screen. */ @implementation NSWindow(TKWm) #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 - (NSPoint) convertPointToScreen: (NSPoint) point { return [self convertBaseToScreen:point]; } - (NSPoint) convertPointFromScreen: (NSPoint)point { return [self convertScreenToBase:point]; } #else - (NSPoint) convertPointToScreen: (NSPoint) point { NSRect pointrect; pointrect.origin = point; pointrect.size.width = 0; pointrect.size.height = 0; return [self convertRectToScreen:pointrect].origin; } - (NSPoint) convertPointFromScreen: (NSPoint)point { NSRect pointrect; pointrect.origin = point; pointrect.size.width = 0; pointrect.size.height = 0; return [self convertRectFromScreen:pointrect].origin; } #endif @end #pragma mark - /* * Forward declarations for procedures defined in this file: */ |
︙ | ︙ | |||
360 361 362 363 364 365 366 | static void GetMinSize(TkWindow *winPtr, int *minWidthPtr, int *minHeightPtr); static void GetMaxSize(TkWindow *winPtr, int *maxWidthPtr, int *maxHeightPtr); static void RemapWindows(TkWindow *winPtr, MacDrawable *parentWin); | < < < < < < < < < < > | > > > > > > > > > > > > > > > > < | 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 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | static void GetMinSize(TkWindow *winPtr, int *minWidthPtr, int *minHeightPtr); static void GetMaxSize(TkWindow *winPtr, int *maxWidthPtr, int *maxHeightPtr); static void RemapWindows(TkWindow *winPtr, MacDrawable *parentWin); #pragma mark TKWindow(TKWm) @interface NSDrawerWindow : NSWindow { id _i1, _i2; } @end @implementation TKWindow: NSWindow #if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_12 /* * Override automatic fullscreen button on >10.12 because system fullscreen API * confuses Tk window geometry. */ - (void)toggleFullScreen:(id)sender { if ([self isZoomed]) { TkMacOSXZoomToplevel(self, inZoomIn); } else { TkMacOSXZoomToplevel(self, inZoomOut); } } #endif @end @implementation TKWindow(TKWm) - (BOOL) canBecomeKeyWindow { TkWindow *winPtr = TkMacOSXGetTkWindow(self); return (winPtr && winPtr->wmInfoPtr && (winPtr->wmInfoPtr->macClass == kHelpWindowClass || winPtr->wmInfoPtr->attributes & kWindowNoActivatesAttribute)) ? NO : YES; } #if DEBUG_ZOMBIES - (id) retain { id result = [super retain]; const char *title = [[self title] UTF8String]; if (title == nil) { title = "unnamed window"; } if (DEBUG_ZOMBIES > 1){ printf("Retained <%s>. Count is: %lu\n", title, [self retainCount]); } return result; } - (id) autorelease { id result = [super autorelease]; const char *title = [[self title] UTF8String]; if (title == nil) { title = "unnamed window"; } if (DEBUG_ZOMBIES > 1){ printf("Autoreleased <%s>. Count is %lu\n", title, [self retainCount]); |
︙ | ︙ | |||
763 764 765 766 767 768 769 770 771 772 773 774 775 776 | /* * Map the window. */ XMapWindow(winPtr->display, winPtr->window); } /* *---------------------------------------------------------------------- * * TkWmUnmapWindow -- * | > > > > | 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 | /* * Map the window. */ XMapWindow(winPtr->display, winPtr->window); /*Add window to Window menu.*/ NSWindow *win = TkMacOSXDrawableWindow(winPtr->window); [win setExcludedFromWindowsMenu:NO]; } /* *---------------------------------------------------------------------- * * TkWmUnmapWindow -- * |
︙ | ︙ | |||
873 874 875 876 877 878 879 | NSWindow *window = wmPtr->window; if (window && !Tk_IsEmbedded(winPtr) ) { NSWindow *parent = [window parentWindow]; if (parent) { [parent removeChildWindow:window]; } | < < < < < | > > > > > | | > > > > > > > > > > | | > | | > > > > > > > > > | 881 882 883 884 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 | NSWindow *window = wmPtr->window; if (window && !Tk_IsEmbedded(winPtr) ) { NSWindow *parent = [window parentWindow]; if (parent) { [parent removeChildWindow:window]; } #if DEBUG_ZOMBIES > 0 { const char *title = [[window title] UTF8String]; if (title == nil) { title = "unnamed window"; } printf(">>>> Closing <%s>. Count is: %lu\n", title, [window retainCount]); } #endif [window close]; TkMacOSXUnregisterMacWindow(window); if (winPtr->window) { ((MacDrawable *) winPtr->window)->view = nil; } wmPtr->window = NULL; [window release]; /* Activate the highest window left on the screen. */ NSArray *windows = [NSApp orderedWindows]; for (id nswindow in windows) { TkWindow *winPtr2 = TkMacOSXGetTkWindow(nswindow); if (winPtr2 && nswindow != window) { WmInfo *wmPtr = winPtr2->wmInfoPtr; BOOL minimized = (wmPtr->hints.initial_state == IconicState || wmPtr->hints.initial_state == WithdrawnState); /* * If no windows are left on the screen and the next * window is iconified or withdrawn, we don't want to * make it be the KeyWindow because that would cause * it to be displayed on the screen. */ if ([nswindow canBecomeKeyWindow] && !minimized) { [nswindow makeKeyAndOrderFront:NSApp]; break; } } } /* * Process all window events immediately to force the closed window to * be deallocated. But don't do this for the root window as that is * unnecessary and can lead to segfaults. */ if (winPtr->parentPtr) { while (Tk_DoOneEvent(TK_WINDOW_EVENTS|TK_DONT_WAIT)) {} } [NSApp _resetAutoreleasePool]; #if DEBUG_ZOMBIES > 0 fprintf(stderr, "================= Pool dump ===================\n"); [NSAutoreleasePool showPools]; #endif } |
︙ | ︙ | |||
1931 1932 1933 1934 1935 1936 1937 | TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; int reqWidth, reqHeight, widthInc, heightInc; | | | 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 | TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; int reqWidth, reqHeight, widthInc, heightInc; const char *errorMsg; if ((objc != 3) && (objc != 7)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?baseWidth baseHeight widthInc heightInc?"); return TCL_ERROR; } if (objc == 3) { |
︙ | ︙ | |||
2310 2311 2312 2313 2314 2315 2316 | /* *---------------------------------------------------------------------- * * WmIconphotoCmd -- * * This procedure is invoked to process the "wm iconphoto" Tcl command. | | < > | | | > > | | < | | > > > > | | > | | | | | | | | < | | < > > > > | < < | > | 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 | /* *---------------------------------------------------------------------- * * WmIconphotoCmd -- * * This procedure is invoked to process the "wm iconphoto" Tcl command. * See the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * See the user documentation. * * *---------------------------------------------------------------------- */ static int WmIconphotoCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Image tk_icon; int width, height, isDefault = 0; if (objc < 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?-default? image1 ?image2 ...?"); return TCL_ERROR; } /*Parse args.*/ if (strcmp(Tcl_GetString(objv[3]), "-default") == 0) { isDefault = 1; if (objc == 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?-default? image1 ?image2 ...?"); return TCL_ERROR; } } /*Get icon name. We only use the first icon name because macOS does not support multiple images in Tk photos.*/ char *icon; if (strcmp(Tcl_GetString(objv[3]), "-default") == 0) { icon = Tcl_GetString(objv[4]); } else { icon = Tcl_GetString(objv[3]); } /*Get image and convert to NSImage that can be displayed as icon.*/ tk_icon = Tk_GetImage(interp, tkwin, icon, NULL, NULL); if (tk_icon == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't use \"%s\" as iconphoto: not a photo image", icon)); Tcl_SetErrorCode(interp, "TK", "WM", "ICONPHOTO", "PHOTO", NULL); return TCL_ERROR; } NSImage *newIcon; Tk_SizeOfImage(tk_icon, &width, &height); newIcon = TkMacOSXGetNSImageWithTkImage(winPtr->display, tk_icon, width, height); Tk_FreeImage(tk_icon); if (newIcon == NULL) { return TCL_ERROR; } [NSApp setApplicationIconImage: newIcon]; return TCL_OK; } /* *---------------------------------------------------------------------- * * WmIconpositionCmd -- |
︙ | ︙ | |||
3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 | Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't withdraw %s: it is an icon for %s", Tcl_GetString(objv[2]), Tk_PathName(wmPtr->iconFor))); Tcl_SetErrorCode(interp, "TK", "WM", "WITHDRAW", "ICON", NULL); return TCL_ERROR; } TkpWmSetState(winPtr, WithdrawnState); return TCL_OK; } /* * Invoked by those wm subcommands that affect geometry. * Schedules a geometry update. */ | > > > > | 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 | Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't withdraw %s: it is an icon for %s", Tcl_GetString(objv[2]), Tk_PathName(wmPtr->iconFor))); Tcl_SetErrorCode(interp, "TK", "WM", "WITHDRAW", "ICON", NULL); return TCL_ERROR; } TkpWmSetState(winPtr, WithdrawnState); /*Remove window from Window menu.*/ NSWindow *win = TkMacOSXDrawableWindow(winPtr->window); [win setExcludedFromWindowsMenu:YES]; return TCL_OK; } /* * Invoked by those wm subcommands that affect geometry. * Schedules a geometry update. */ |
︙ | ︙ | |||
4631 4632 4633 4634 4635 4636 4637 | int aboveBelow, /* Gives relative position for restacking; * must be Above or Below. */ TkWindow *otherPtr) /* Window relative to which to restack; if * NULL, then winPtr gets restacked above or * below *all* siblings. */ { NSWindow *macWindow; | | > > > | > > > > | > > > > > > > > > > | < > > > | | > > > | | < < | > | < < | > < < < < < < < < < < < < < | < | 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 | int aboveBelow, /* Gives relative position for restacking; * must be Above or Below. */ TkWindow *otherPtr) /* Window relative to which to restack; if * NULL, then winPtr gets restacked above or * below *all* siblings. */ { NSWindow *macWindow; NSWindow *otherMacWindow; WmInfo *wmPtr = winPtr->wmInfoPtr; int macAboveBelow = (aboveBelow == Above ? NSWindowAbove : NSWindowBelow); int otherNumber = 0; /* 0 will be used when otherPtr is NULL. */ /* * If the Tk windows has no drawable, or is withdrawn do nothing. */ if (winPtr->window == None || wmPtr == NULL || wmPtr->hints.initial_state == WithdrawnState) { return; } macWindow = TkMacOSXDrawableWindow(winPtr->window); if (macWindow == nil) { return; } if (otherPtr) { /* * When otherPtr is non-NULL, if the other window has no * drawable or is withdrawn, do nothing. */ WmInfo *otherWmPtr = otherPtr->wmInfoPtr; if (winPtr->window == None || otherWmPtr == NULL || otherWmPtr->hints.initial_state == WithdrawnState) { return; } otherMacWindow = TkMacOSXDrawableWindow(otherPtr->window); if (otherMacWindow == nil) { return; } else { /* * If the other window is OK, get its number. */ otherNumber = [otherMacWindow windowNumber]; } } /* * Just let the Mac window manager deal with all the subtleties * of keeping track of off-screen windows, etc. */ [macWindow orderWindow:macAboveBelow relativeTo:otherNumber]; } /* *---------------------------------------------------------------------- * * TkWmAddToColormapWindows -- * |
︙ | ︙ | |||
5088 5089 5090 5091 5092 5093 5094 | } /* *---------------------------------------------------------------------- * * TkMacOSXIsWindowZoomed -- * | | | > | 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 | } /* *---------------------------------------------------------------------- * * TkMacOSXIsWindowZoomed -- * * Ask Cocoa if the given window is in the zoomed out state. Because * dragging & growing a window can change the Cocoa zoom state, we * cannot rely on wmInfoPtr->hints.initial_state for this information. * * Results: * True if window is zoomed out, false otherwise. * * Side effects: * None. * *---------------------------------------------------------------------- */ MODULE_SCOPE int TkMacOSXIsWindowZoomed( TkWindow *winPtr) { return [TkMacOSXDrawableWindow(winPtr->window) isZoomed]; } /* *---------------------------------------------------------------------- * * TkMacOSXZoomToplevel -- * * The function is invoked when the user clicks in the zoom region of a |
︙ | ︙ | |||
5149 5150 5151 5152 5153 5154 5155 | return false; } /* * Do nothing if already in desired zoom state. */ | | | > | | | 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 | return false; } /* * Do nothing if already in desired zoom state. */ if ((![window isZoomed] == (zoomPart == inZoomIn))) { return false; } [window zoom:NSApp]; wmPtr->hints.initial_state = (zoomPart == inZoomIn ? NormalState : ZoomState); return true; } /* *---------------------------------------------------------------------- * * TkUnsupported1Cmd -- |
︙ | ︙ | |||
5192 5193 5194 5195 5196 5197 5198 | "style", NULL }; enum SubCmds { TKMWS_STYLE }; Tk_Window tkwin = clientData; TkWindow *winPtr; | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 | "style", NULL }; enum SubCmds { TKMWS_STYLE }; Tk_Window tkwin = clientData; TkWindow *winPtr; int index; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "option window ?arg ...?"); return TCL_ERROR; } winPtr = (TkWindow *) Tk_NameToWindow(interp, Tcl_GetString(objv[2]), tkwin); if (winPtr == NULL) { return TCL_ERROR; } if (!(winPtr->flags & TK_TOP_LEVEL)) { |
︙ | ︙ | |||
5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 | NSWindow *window = [[winClass alloc] initWithContentRect:contentRect styleMask:styleMask backing:NSBackingStoreBuffered defer:YES]; if (!window) { Tcl_Panic("couldn't allocate new Mac window"); } TKContentView *contentView = [[TKContentView alloc] initWithFrame:NSZeroRect]; [window setContentView:contentView]; [contentView release]; [window setDelegate:NSApp]; [window setAcceptsMouseMovedEvents:YES]; [window setReleasedWhenClosed:NO]; [window setAutodisplay:NO]; if (styleMask & NSUtilityWindowMask) { [(NSPanel*)window setFloatingPanel:YES]; } if ((styleMask & (NSTexturedBackgroundWindowMask|NSHUDWindowMask)) && !(styleMask & NSDocModalWindowMask)) { /* * Workaround for [Bug 2824538]: Texured windows are draggable * from opaque content. */ [window setMovableByWindowBackground:NO]; } | > < < < < < < < < < < < < < < | 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 | NSWindow *window = [[winClass alloc] initWithContentRect:contentRect styleMask:styleMask backing:NSBackingStoreBuffered defer:YES]; if (!window) { Tcl_Panic("couldn't allocate new Mac window"); } TKContentView *contentView = [[TKContentView alloc] initWithFrame:NSZeroRect]; [window setColorSpace:[NSColorSpace deviceRGBColorSpace]]; [window setContentView:contentView]; [contentView release]; [window setDelegate:NSApp]; [window setAcceptsMouseMovedEvents:YES]; [window setReleasedWhenClosed:NO]; [window setAutodisplay:NO]; if (styleMask & NSUtilityWindowMask) { [(NSPanel*)window setFloatingPanel:YES]; } if ((styleMask & (NSTexturedBackgroundWindowMask|NSHUDWindowMask)) && !(styleMask & NSDocModalWindowMask)) { /* * Workaround for [Bug 2824538]: Texured windows are draggable * from opaque content. */ [window setMovableByWindowBackground:NO]; } [window setDocumentEdited:NO]; wmPtr->window = window; macWin->view = window.contentView; TkMacOSXApplyWindowAttributes(winPtr, window); NSRect geometry = InitialWindowBounds(winPtr, window); geometry.size.width += structureRect.size.width; |
︙ | ︙ | |||
6324 6325 6326 6327 6328 6329 6330 | initial) { NSWindowCollectionBehavior b = NSWindowCollectionBehaviorDefault; if (newAttributes & tkCanJoinAllSpacesAttribute) { b |= NSWindowCollectionBehaviorCanJoinAllSpaces; } else if (newAttributes & tkMoveToActiveSpaceAttribute) { b |= NSWindowCollectionBehaviorMoveToActiveSpace; } | < < < < < < < < < < < < | 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 | initial) { NSWindowCollectionBehavior b = NSWindowCollectionBehaviorDefault; if (newAttributes & tkCanJoinAllSpacesAttribute) { b |= NSWindowCollectionBehaviorCanJoinAllSpaces; } else if (newAttributes & tkMoveToActiveSpaceAttribute) { b |= NSWindowCollectionBehaviorMoveToActiveSpace; } if (newAttributes & kWindowDoesNotCycleAttribute) { b |= NSWindowCollectionBehaviorIgnoresCycle; } else { b |= NSWindowCollectionBehaviorParticipatesInCycle; } [macWindow setCollectionBehavior:b]; } if ((wmPtr->flags & WM_TOPMOST) != (oldFlags & WM_TOPMOST)) { [macWindow setLevel:(wmPtr->flags & WM_TOPMOST) ? kCGUtilityWindowLevel : ([macWindow isKindOfClass: [NSPanel class]] && [macWindow isFloatingPanel] ? kCGFloatingWindowLevel : kCGNormalWindowLevel)]; } |
︙ | ︙ | |||
6473 6474 6475 6476 6477 6478 6479 | TkWindow *winPtr, NSWindow *window, int fullscreen, Tcl_Interp *interp) { WmInfo *wmPtr = winPtr->wmInfoPtr; int result = TCL_OK, wasFullscreen = (wmPtr->flags & WM_FULLSCREEN); | < < | 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 | TkWindow *winPtr, NSWindow *window, int fullscreen, Tcl_Interp *interp) { WmInfo *wmPtr = winPtr->wmInfoPtr; int result = TCL_OK, wasFullscreen = (wmPtr->flags & WM_FULLSCREEN); static unsigned long prevMask = 0, prevPres = 0; if (fullscreen) { int screenWidth = WidthOfScreen(Tk_Screen(winPtr)); int screenHeight = HeightOfScreen(Tk_Screen(winPtr)); /* * Check max width and height if set by the user. |
︙ | ︙ | |||
6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 | " width/height is too small", winPtr->pathName)); Tcl_SetErrorCode(interp, "TK", "FULLSCREEN", "CONSTRAINT_FAILURE", NULL); } result = TCL_ERROR; wmPtr->flags &= ~WM_FULLSCREEN; } else { NSRect bounds = [window contentRectForFrameRect:[window frame]]; NSRect screenBounds = NSMakeRect(0, 0, screenWidth, screenHeight); if (!NSEqualRects(bounds, screenBounds) && !wasFullscreen) { wmPtr->configX = wmPtr->x; wmPtr->configY = wmPtr->y; wmPtr->configAttributes = wmPtr->attributes; wmPtr->attributes &= ~kWindowResizableAttribute; ApplyWindowAttributeFlagChanges(winPtr, window, wmPtr->configAttributes, wmPtr->flags, 1, 0); wmPtr->flags |= WM_SYNC_PENDING; [window setFrame:[window frameRectForContentRect: screenBounds] display:YES]; wmPtr->flags &= ~WM_SYNC_PENDING; } wmPtr->flags |= WM_FULLSCREEN; } | > < < < < < < < < | < < < > > | 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 | " width/height is too small", winPtr->pathName)); Tcl_SetErrorCode(interp, "TK", "FULLSCREEN", "CONSTRAINT_FAILURE", NULL); } result = TCL_ERROR; wmPtr->flags &= ~WM_FULLSCREEN; } else { Tk_UnmapWindow((Tk_Window) winPtr); NSRect bounds = [window contentRectForFrameRect:[window frame]]; NSRect screenBounds = NSMakeRect(0, 0, screenWidth, screenHeight); if (!NSEqualRects(bounds, screenBounds) && !wasFullscreen) { wmPtr->configX = wmPtr->x; wmPtr->configY = wmPtr->y; wmPtr->configAttributes = wmPtr->attributes; wmPtr->attributes &= ~kWindowResizableAttribute; ApplyWindowAttributeFlagChanges(winPtr, window, wmPtr->configAttributes, wmPtr->flags, 1, 0); wmPtr->flags |= WM_SYNC_PENDING; [window setFrame:[window frameRectForContentRect: screenBounds] display:YES]; wmPtr->flags &= ~WM_SYNC_PENDING; } wmPtr->flags |= WM_FULLSCREEN; } prevMask = [window styleMask]; prevPres = [NSApp presentationOptions]; [window setStyleMask: NSBorderlessWindowMask]; [NSApp setPresentationOptions: NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar]; Tk_MapWindow((Tk_Window) winPtr); } else { wmPtr->flags &= ~WM_FULLSCREEN; [NSApp setPresentationOptions: prevPres]; [window setStyleMask: prevMask]; } if (wasFullscreen && !(wmPtr->flags & WM_FULLSCREEN)) { Tk_UnmapWindow((Tk_Window) winPtr); UInt64 oldAttributes = wmPtr->attributes; NSRect bounds = NSMakeRect(wmPtr->configX, tkMacOSXZeroScreenHeight - (wmPtr->configY + wmPtr->yInParent + wmPtr->configHeight), wmPtr->xInParent + wmPtr->configWidth, wmPtr->yInParent + wmPtr->configHeight); wmPtr->attributes |= wmPtr->configAttributes & kWindowResizableAttribute; ApplyWindowAttributeFlagChanges(winPtr, window, oldAttributes, wmPtr->flags, 1, 0); wmPtr->flags |= WM_SYNC_PENDING; [window setFrame:[window frameRectForContentRect:bounds] display:YES]; wmPtr->flags &= ~WM_SYNC_PENDING; Tk_MapWindow((Tk_Window) winPtr); } return result; } /* *---------------------------------------------------------------------- * |
︙ | ︙ |
Changes to macosx/tkMacOSXXStubs.c.
︙ | ︙ | |||
49 50 51 52 53 54 55 | * Forward declarations of procedures used in this file. */ static XID MacXIdAlloc(Display *display); static int DefaultErrorHandler(Display *display, XErrorEvent *err_evt); | < < < < < < < < | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | * Forward declarations of procedures used in this file. */ static XID MacXIdAlloc(Display *display); static int DefaultErrorHandler(Display *display, XErrorEvent *err_evt); /* *---------------------------------------------------------------------- * * TkMacOSXDisplayChanged -- * * Called to set up initial screen info or when an event indicated |
︙ | ︙ | |||
179 180 181 182 183 184 185 | snprintf(vendor, sizeof(vendor), "Apple AppKit %g", NSAppKitVersionNumber); } display->vendor = vendor; { int major, minor, patch; | | | 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | snprintf(vendor, sizeof(vendor), "Apple AppKit %g", NSAppKitVersionNumber); } display->vendor = vendor; { int major, minor, patch; #if MAC_OS_X_VERSION_MIN_REQUIRED < 1080 Gestalt(gestaltSystemVersionMajor, (SInt32*)&major); Gestalt(gestaltSystemVersionMinor, (SInt32*)&minor); Gestalt(gestaltSystemVersionBugFix, (SInt32*)&patch); #else NSOperatingSystemVersion systemVersion = [[NSProcessInfo processInfo] operatingSystemVersion]; major = systemVersion.majorVersion; minor = systemVersion.minorVersion; |
︙ | ︙ | |||
204 205 206 207 208 209 210 211 212 213 214 215 216 217 | screen->black_pixel = 0x00000000 | PIXEL_MAGIC << 24; screen->white_pixel = 0x00FFFFFF | PIXEL_MAGIC << 24; screen->ext_data = (XExtData *) &maxBounds; screen->root_visual = ckalloc(sizeof(Visual)); screen->root_visual->visualid = 0; screen->root_visual->class = TrueColor; screen->root_visual->red_mask = 0x00FF0000; screen->root_visual->green_mask = 0x0000FF00; screen->root_visual->blue_mask = 0x000000FF; screen->root_visual->bits_per_rgb = 24; screen->root_visual->map_entries = 256; /* | > | 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | screen->black_pixel = 0x00000000 | PIXEL_MAGIC << 24; screen->white_pixel = 0x00FFFFFF | PIXEL_MAGIC << 24; screen->ext_data = (XExtData *) &maxBounds; screen->root_visual = ckalloc(sizeof(Visual)); screen->root_visual->visualid = 0; screen->root_visual->class = TrueColor; screen->root_visual->alpha_mask = 0xFF000000; screen->root_visual->red_mask = 0x00FF0000; screen->root_visual->green_mask = 0x0000FF00; screen->root_visual->blue_mask = 0x000000FF; screen->root_visual->bits_per_rgb = 24; screen->root_visual->map_entries = 256; /* |
︙ | ︙ | |||
379 380 381 382 383 384 385 | Display * display, Atom atom) { display->request++; return NULL; } | < < < < < < < | 372 373 374 375 376 377 378 379 380 381 382 383 384 385 | Display * display, Atom atom) { display->request++; return NULL; } XErrorHandler XSetErrorHandler( XErrorHandler handler) { return DefaultErrorHandler; } |
︙ | ︙ | |||
758 759 760 761 762 763 764 | ProtocolVersion(Tk_Display(tkwin)), ProtocolRevision(Tk_Display(tkwin))); snprintf(buffer2, sizeof(buffer2), " Mac OS X %x", VendorRelease(Tk_Display(tkwin))); Tcl_AppendResult(interp, buffer, ServerVendor(Tk_Display(tkwin)), buffer2, NULL); } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 744 745 746 747 748 749 750 751 752 753 754 755 756 757 | ProtocolVersion(Tk_Display(tkwin)), ProtocolRevision(Tk_Display(tkwin))); snprintf(buffer2, sizeof(buffer2), " Mac OS X %x", VendorRelease(Tk_Display(tkwin))); Tcl_AppendResult(interp, buffer, ServerVendor(Tk_Display(tkwin)), buffer2, NULL); } /* *---------------------------------------------------------------------- * * XChangeWindowAttributes, XSetWindowBackground, * XSetWindowBackgroundPixmap, XSetWindowBorder, XSetWindowBorderPixmap, * XSetWindowBorderWidth, XSetWindowColormap |
︙ | ︙ | |||
1365 1366 1367 1368 1369 1370 1371 | *---------------------------------------------------------------------- */ void Tk_ResetUserInactiveTime( Display *dpy) { | | | 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 | *---------------------------------------------------------------------- */ void Tk_ResetUserInactiveTime( Display *dpy) { IOGPoint loc = {0, 0}; kern_return_t kr; NXEvent nullEvent = {NX_NULLEVENT, {0, 0}, 0, -1, 0}; enum { kNULLEventPostThrottle = 10 }; static io_connect_t io_connection = MACH_PORT_NULL; if (io_connection == MACH_PORT_NULL) { io_service_t service = IOServiceGetMatchingService( |
︙ | ︙ |
Changes to tests/bind.test.
︙ | ︙ | |||
29 30 31 32 33 34 35 36 37 38 39 40 41 42 | bind all <Enter> {} bind Test <Enter> {} bind Toplevel <Enter> {} bind xyz <Enter> {} bind {a b} <Enter> {} bind .t <Enter> {} } # move the mouse pointer away of the testing area # otherwise some spurious events may pollute the tests toplevel .top wm geometry .top 50x50-50-50 update event generate .top <Button-1> -warp 1 | > > > > > > > > > > > > > | 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 | bind all <Enter> {} bind Test <Enter> {} bind Toplevel <Enter> {} bind xyz <Enter> {} bind {a b} <Enter> {} bind .t <Enter> {} } # This function fills the pattern matcher's ring buffer with events of # the specified type. This can be used when testing with generated # events to make sure that there are no stray events in the ring # buffer which might cause the pattern matcher to find unintended # matches. The size of the ring buffer is EVENT_BUFFER_SIZE, which is # currently set to 30. If this changes, the code below will need to # change. proc clearRingBuffer {{event}} { for {set i 0} {$i < 30} {incr i} { event generate . $event } } # move the mouse pointer away of the testing area # otherwise some spurious events may pollute the tests toplevel .top wm geometry .top 50x50-50-50 update event generate .top <Button-1> -warp 1 |
︙ | ︙ | |||
644 645 646 647 648 649 650 | 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" | | | | 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 | 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> -keycode -1 event generate .t.f <KeyRelease> -keycode -1 return $x } -cleanup { destroy .t.f } -result {Key?? Release??} test bind-13.15 {Tk_BindEvent procedure: button detail} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f |
︙ | ︙ | |||
1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 | destroy .t.f } -result {0} test bind-15.22 {MatchPatterns procedure, time wrap-around} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update } -body { bind .t.f <Double-1> {set x 1} set x 0 | > | > < > > > | 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 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 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 | destroy .t.f } -result {0} test bind-15.22 {MatchPatterns procedure, time wrap-around} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update clearRingBuffer <Key> } -body { bind .t.f <Double-1> {set x 1} set x 0 event generate .t.f <Button-1> -time -100 event generate .t.f <Button-1> -time 200 event generate .t.f <ButtonRelease-1> return $x } -cleanup { destroy .t.f } -result {1} test bind-15.23 {MatchPatterns procedure, time wrap-around} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update clearRingBuffer <Key> } -body { bind .t.f <Double-1> {set x 1} set x 0 event generate .t.f <Button-1> -time -100 event generate .t.f <Button-1> -time 500 event generate .t.f <ButtonRelease-1> return $x } -cleanup { destroy .t.f } -result {0} test bind-15.24 {MatchPatterns procedure, virtual event} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update set x {} clearRingBuffer <Key> } -body { event add <<Paste>> <Button-1> bind .t.f <<Paste>> {lappend x paste} event generate .t.f <Button-1> event generate .t.f <ButtonRelease-1> set x } -cleanup { destroy .t.f event delete <<Paste>> <Button-1> } -result {paste} test bind-15.25 {MatchPatterns procedure, reject a virtual event} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update set x {} clearRingBuffer <Key> } -body { event add <<Paste>> <Shift-Button-1> bind .t.f <<Paste>> {lappend x paste} event generate .t.f <Button-1> event generate .t.f <ButtonRelease-1> set x } -cleanup { destroy .t.f event delete <<Paste>> <Shift-Button-1> } -result {} test bind-15.26 {MatchPatterns procedure, reject a virtual event} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update set x {} clearRingBuffer <Key> } -body { event add <<V1>> <Button> event add <<V2>> <Button-1> event add <<V3>> <Shift-Button-1> bind .t.f <<V2>> "lappend x V2%#" event generate .t.f <Button> -serial 101 event generate .t.f <Button-1> -serial 102 |
︙ | ︙ | |||
1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 | event delete <<V3>> <Shift-Button-1> } -result {V2102 V2103 V2105 Shift-Button-1} test bind-15.27 {MatchPatterns procedure, conflict resolution} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update } -body { bind .t.f <KeyPress> {set x 0} bind .t.f 1 {set x 1} set x none event generate .t.f <Key-1> return $x } -cleanup { destroy .t.f } -result {1} test bind-15.28 {MatchPatterns procedure, conflict resolution} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update } -body { bind .t.f <KeyPress> {set x 0} bind .t.f 1 {set x 1} set x none event generate .t.f <Key-2> return $x } -cleanup { destroy .t.f } -result {0} test bind-15.29 {MatchPatterns procedure, conflict resolution} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update } -body { bind .t.f <KeyPress> {lappend x 0} bind .t.f 1 {lappend x 1} bind .t.f 21 {lappend x 2} set x none event generate .t.f <Key-2> event generate .t.f <KeyRelease-2> event generate .t.f <Key-1> set x } -cleanup { destroy .t.f } -result {none 0 2} test bind-15.30 {MatchPatterns procedure, conflict resolution} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update } -body { bind .t.f <ButtonPress> {set x 0} bind .t.f <1> {set x 1} set x none event generate .t.f <Button-1> event generate .t.f <ButtonRelease-1> return $x } -cleanup { destroy .t.f } -result {1} test bind-15.31 {MatchPatterns procedure, conflict resolution} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update set x {} } -body { bind .t.f <M1-Key> {set x 0} bind .t.f <M2-Key> {set x 1} event generate .t.f <Key-a> -state 0x18 return $x } -cleanup { destroy .t.f } -result {1} test bind-15.32 {MatchPatterns procedure, conflict resolution} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update } -body { bind .t.f <M2-Key> {set x 0} bind .t.f <M1-Key> {set x 1} set x none event generate .t.f <Key-a> -state 0x18 return $x } -cleanup { destroy .t.f } -result {1} test bind-15.33 {MatchPatterns procedure, conflict resolution} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update set x {} } -body { bind .t.f <1> {lappend x single} bind Test <1> {lappend x single(Test)} bind Test <Double-1> {lappend x double(Test)} event generate .t.f <Button-1> event generate .t.f <Button-1> event generate .t.f <Button-1> | > > > > > > > | 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 | event delete <<V3>> <Shift-Button-1> } -result {V2102 V2103 V2105 Shift-Button-1} test bind-15.27 {MatchPatterns procedure, conflict resolution} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update clearRingBuffer <Button> } -body { bind .t.f <KeyPress> {set x 0} bind .t.f 1 {set x 1} set x none event generate .t.f <Key-1> return $x } -cleanup { destroy .t.f } -result {1} test bind-15.28 {MatchPatterns procedure, conflict resolution} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update clearRingBuffer <Button> } -body { bind .t.f <KeyPress> {set x 0} bind .t.f 1 {set x 1} set x none event generate .t.f <Key-2> return $x } -cleanup { destroy .t.f } -result {0} test bind-15.29 {MatchPatterns procedure, conflict resolution} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update clearRingBuffer <Button> } -body { bind .t.f <KeyPress> {lappend x 0} bind .t.f 1 {lappend x 1} bind .t.f 21 {lappend x 2} set x none event generate .t.f <Key-2> event generate .t.f <KeyRelease-2> event generate .t.f <Key-1> set x } -cleanup { destroy .t.f } -result {none 0 2} test bind-15.30 {MatchPatterns procedure, conflict resolution} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update clearRingBuffer <Key> } -body { bind .t.f <ButtonPress> {set x 0} bind .t.f <1> {set x 1} set x none event generate .t.f <Button-1> event generate .t.f <ButtonRelease-1> return $x } -cleanup { destroy .t.f } -result {1} test bind-15.31 {MatchPatterns procedure, conflict resolution} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update set x {} clearRingBuffer <Button> } -body { bind .t.f <M1-Key> {set x 0} bind .t.f <M2-Key> {set x 1} event generate .t.f <Key-a> -state 0x18 return $x } -cleanup { destroy .t.f } -result {1} test bind-15.32 {MatchPatterns procedure, conflict resolution} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update clearRingBuffer <Button> } -body { bind .t.f <M2-Key> {set x 0} bind .t.f <M1-Key> {set x 1} set x none event generate .t.f <Key-a> -state 0x18 return $x } -cleanup { destroy .t.f } -result {1} test bind-15.33 {MatchPatterns procedure, conflict resolution} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update set x {} clearRingBuffer <Key> } -body { bind .t.f <1> {lappend x single} bind Test <1> {lappend x single(Test)} bind Test <Double-1> {lappend x double(Test)} event generate .t.f <Button-1> event generate .t.f <Button-1> event generate .t.f <Button-1> |
︙ | ︙ | |||
2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 | set savedBind(All) [bind all <Key>] set savedBind(Entry) [bind Entry <Key>] entry .t.e pack .t.e focus -force .t.e foreach p [event info] {event delete $p} update } -body { bind all <Key> {set z "%M"} bind Entry <Key> {set y "%M"} bind .t.e <Key> {set x "%M"} set x none; set y none; set z none event gen .t.e <Key-a> list $x $y $z | > | 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 | set savedBind(All) [bind all <Key>] set savedBind(Entry) [bind Entry <Key>] entry .t.e pack .t.e focus -force .t.e foreach p [event info] {event delete $p} update clearRingBuffer <Button> } -body { bind all <Key> {set z "%M"} bind Entry <Key> {set y "%M"} bind .t.e <Key> {set x "%M"} set x none; set y none; set z none event gen .t.e <Key-a> list $x $y $z |
︙ | ︙ |
Changes to tests/busy.test.
︙ | ︙ | |||
89 90 91 92 93 94 95 | update } -cleanup { tk busy forget . } -result {} test busy-2.12 {tk busy hold root window, invalid cursor} -body { tk busy hold . -cursor nonExistingCursor update | | | | | | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | update } -cleanup { tk busy forget . } -result {} test busy-2.12 {tk busy hold root window, invalid cursor} -body { tk busy hold . -cursor nonExistingCursor update } -returnCodes error -cleanup { tk busy forget . } -result {bad cursor spec "nonExistingCursor"} test busy-2.13 {tk busy hold (shortcut) root window, invalid cursor} -body { tk busy . -cursor nonExistingCursor update } -returnCodes error -cleanup { tk busy forget . } -result {bad cursor spec "nonExistingCursor"} test busy-2.14 {tk busy hold root window, invalid option} -body { tk busy hold . -invalidOption 1 update } -returnCodes error -cleanup { tk busy forget . } -result {unknown option "-invalidOption"} test busy-2.15 {tk busy hold (shortcut) root window, invalid option} -body { tk busy . -invalidOption 1 update } -returnCodes error -cleanup { tk busy forget . } -result {unknown option "-invalidOption"} test busy-3.1 {tk busy cget no window} -returnCodes error -body { tk busy cget } -result {wrong # args: should be "tk busy cget window option"} test busy-3.2 {tk busy cget no option} -returnCodes error -body { |
︙ | ︙ | |||
166 167 168 169 170 171 172 | tk busy hold .f -cursor hand1 update } -body { tk busy cget .f -cursor } -cleanup { tk busy forget .f destroy .f | | | 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | tk busy hold .f -cursor hand1 update } -body { tk busy cget .f -cursor } -cleanup { tk busy forget .f destroy .f } -result {hand1} test busy-4.1 {tk busy configure no window} -returnCodes error -body { tk busy configure } -result {wrong # args: should be "tk busy configure window ?option? ?value ...?"} test busy-4.2 {tk busy configure invalid window} -body { tk busy configure .f |
︙ | ︙ | |||
206 207 208 209 210 211 212 | } -body { tk busy configure .f } -cleanup { tk busy forget .f destroy .f } -result {{-cursor cursor Cursor wait wait}} | | | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | } -body { tk busy configure .f } -cleanup { tk busy forget .f destroy .f } -result {{-cursor cursor Cursor wait wait}} test busy-4.5 {tk busy configure} -constraints {nonwin} -setup { pack [frame .f] tk busy hold .f -cursor hand2 update } -body { tk busy configure .f } -cleanup { tk busy forget .f |
︙ | ︙ | |||
262 263 264 265 266 267 268 | tk busy configure .f -cursor } -cleanup { tk busy forget .f destroy .f } -result {-cursor cursor Cursor wait wait} test busy-4.8 {tk busy configure valid option} -constraints { | | | 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | tk busy configure .f -cursor } -cleanup { tk busy forget .f destroy .f } -result {-cursor cursor Cursor wait wait} test busy-4.8 {tk busy configure valid option} -constraints { nonwin } -setup { pack [frame .f] tk busy hold .f -cursor circle update } -body { tk busy configure .f -cursor } -cleanup { |
︙ | ︙ | |||
295 296 297 298 299 300 301 | update } -body { tk busy configure .f -cursor pencil tk busy cget .f -cursor } -cleanup { tk busy forget .f destroy .f | | | | 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | update } -body { tk busy configure .f -cursor pencil tk busy cget .f -cursor } -cleanup { tk busy forget .f destroy .f } -result {pencil} test busy-4.10 {tk busy configure valid option with invalid value} -setup { pack [frame .f] tk busy hold .f update } -body { tk busy configure .f -cursor nonExistingCursor } -returnCodes error -cleanup { tk busy forget .f destroy .f } -result {bad cursor spec "nonExistingCursor"} test busy-5.1 {tk busy forget} -returnCodes error -body { tk busy forget } -result {wrong # args: should be "tk busy forget window"} |
︙ | ︙ |
Changes to tests/canvas.test.
︙ | ︙ | |||
945 946 947 948 949 950 951 952 953 954 955 956 957 958 | canvas .c } -body { set id [.c create line 0 0 1 1] .c rchars $id 1 foo {2 2} } -cleanup { destroy .c } -returnCodes error -result {bad index "foo"} # cleanup imageCleanup cleanupTests return # Local Variables: | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 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 | canvas .c } -body { set id [.c create line 0 0 1 1] .c rchars $id 1 foo {2 2} } -cleanup { destroy .c } -returnCodes error -result {bad index "foo"} # Procedure used in test cases 20.1 20.2 20.3 proc matchPixels {pixels expected} { set matched 1 foreach pline $pixels eline $expected { foreach ppixel $pline epixel $eline { if {$ppixel != $epixel} { set matched 0 break } } } return $matched } test canvas-20.1 {canvas image} -setup { canvas .c image create photo testimage } -body { .c configure -background #c0c0c0 -scrollregion {0 0 9 9} .c create rectangle 0 0 0 9 -fill #000080 -outline #000080 .c image testimage matchPixels [testimage data] { \ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0}} } -cleanup { destroy .c image delete testimage } -result 1 test canvas-20.2 {canvas image with subsample} -setup { canvas .c image create photo testimage } -body { .c configure -background #c0c0c0 -scrollregion {0 0 9 9} .c create rectangle 0 0 1 9 -fill #008000 -outline #008000 .c image testimage 2 matchPixels [testimage data] { \ {#008000 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#008000 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#008000 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#008000 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#008000 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0}} } -cleanup { destroy .c image delete testimage } -result 1 test canvas-20.3 {canvas image with subsample and zoom} -setup { canvas .c image create photo testimage } -body { .c configure -background #c0c0c0 -scrollregion {0 0 9 9} .c create rectangle 0 0 9 0 -fill #800000 -outline #800000 .c image testimage 1 2 matchPixels [testimage data] { \ {#800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000} \ {#800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0}} } -cleanup { destroy .c image delete testimage } -result 1 # cleanup imageCleanup cleanupTests return # Local Variables: |
︙ | ︙ |
Changes to tests/entry.test.
︙ | ︙ | |||
347 348 349 350 351 352 353 | } -body { .e configure -insertbackground non-existent } -cleanup { destroy .e } -returnCodes {error} -result {unknown color name "non-existent"} test entry-1.32 {configuration option: "insertborderwidth" for entry} -setup { | | | 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 | } -body { .e configure -insertbackground non-existent } -cleanup { destroy .e } -returnCodes {error} -result {unknown color name "non-existent"} test entry-1.32 {configuration option: "insertborderwidth" for entry} -setup { entry .e -borderwidth 2 -insertwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e update } -body { .e configure -insertborderwidth 1.3 .e cget -insertborderwidth } -cleanup { destroy .e |
︙ | ︙ | |||
2566 2567 2568 2569 2570 2571 2572 | } -result {1 6} | | | | | 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 | } -result {1 6} test entry-13.10 {GetEntryIndex procedure} -constraints x11 -body { # On unix, when selection is cleared, entry widget's internal # selection range is reset. # Previous settings: entry .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e .e insert 0 012345678901234567890 .e xview 4 update .e select from 1 .e select to 6 list [.e index sel.first] [.e index sel.last] # Testing: selection clear .e .e index sel.first } -cleanup { destroy .e } -returnCodes error -result {selection isn't in widget .e} test entry-13.11 {GetEntryIndex procedure} -constraints aquaOrWin32 -body { # On mac and pc, when selection is cleared, entry widget remembers # last selected range. When selection ownership is restored to # entry, the old range will be rehighlighted. # Previous settings: entry .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e .e insert 0 012345678901234567890 .e xview 4 update .e select from 1 .e select to 6 list [.e index sel.first] [.e index sel.last] # Testing: selection clear .e catch {selection get} .e index sel.first } -cleanup { destroy .e } -result {1} test entry-13.12 {GetEntryIndex procedure} -constraints x11 -body { # Previous settings: entry .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e .e insert 0 012345678901234567890 .e xview 4 update .e select from 1 |
︙ | ︙ |
Changes to tests/font.test.
︙ | ︙ | |||
1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 | test font-31.6 {Tk_IntersectTextLayout procedure: ignore spaces at eol} -body { csetup "000\n000 000000000" .t.c itemconfig text -width [expr $ax*10] set x [.t.c find overlapping [expr $ax*5] $ay [expr $ax*5] $ay] .t.c itemconfig text -width 0 return $x } -result {} destroy .t.c test font-32.1 {Tk_TextLayoutToPostscript: ensure buffer doesn't overflow} -setup { destroy .t.c canvas .t.c -closeenough 0 .t.c create text 0 0 -tags text -anchor nw -just left -font "Courier -12" | > > > > > > > > > > | 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 | test font-31.6 {Tk_IntersectTextLayout procedure: ignore spaces at eol} -body { csetup "000\n000 000000000" .t.c itemconfig text -width [expr $ax*10] set x [.t.c find overlapping [expr $ax*5] $ay [expr $ax*5] $ay] .t.c itemconfig text -width 0 return $x } -result {} test font-31.7 {TkIntersectAngledTextLayout procedure: bug [514ff64dd0]} -body { csetup "This is line one\nand line two\nand line three here" .t.c itemconfigure text -angle 90 # Coordinates of the rectangle to check can be hardcoded: # The goal of this test is to check whether the overlap detection algorithm # works when the rectangle is entirely included in a chunk of the text layout. # The text has been rotated 90 degrees around it's upper left corner, # so it's enough to check with a small rectangle with small negative y coords. .t.c find overlapping 5 -7 7 -5 } -result {1} destroy .t.c test font-32.1 {Tk_TextLayoutToPostscript: ensure buffer doesn't overflow} -setup { destroy .t.c canvas .t.c -closeenough 0 .t.c create text 0 0 -tags text -anchor nw -just left -font "Courier -12" |
︙ | ︙ |
Added tests/iDOT.png.
cannot compute difference between binary files
Changes to tests/imgPNG.test.
︙ | ︙ | |||
1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 | set i [image create photo] } -body { $i put $encoded(MultiIDAT) return [image width $i]x[image height $i] } -cleanup { image delete $i } -result 223x212 } namespace delete png imageFinish cleanupTests return | > > > > > > > > > > > | 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 | set i [image create photo] } -body { $i put $encoded(MultiIDAT) return [image width $i]x[image height $i] } -cleanup { image delete $i } -result 223x212 test imgPNG-3.1 {reading image with unknown ancillary chunk - bug [1c659ef0f1]} -setup { set fileName [file join [file dirname [info script]] iDOT.png] } -body { # the image contains an unknown chunk iDOT # since the name of this chunk starts with a lowercase letter, # it's an ancillary chunk that shall not trigger an error catch {set i [image create photo -file $fileName]} } -cleanup { image delete $i } -result {0} } namespace delete png imageFinish cleanupTests return |
︙ | ︙ |
Changes to tests/imgPhoto.test.
︙ | ︙ | |||
815 816 817 818 819 820 821 822 823 824 825 826 827 828 | } -body { file copy -force $teapotPhotoFile -teapotPhotoFile image create photo photo1 photo1 read -teapotPhotoFile } -cleanup { image delete photo1 file delete ./-teapotPhotoFile } -result {} test imgPhoto-5.1 {ImgPhotoGet/Free procedures, shared instances} -constraints { hasTeapotPhoto } -setup { destroy .c pack [canvas .c] | > > > > > > > > > > > > | 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 | } -body { file copy -force $teapotPhotoFile -teapotPhotoFile image create photo photo1 photo1 read -teapotPhotoFile } -cleanup { image delete photo1 file delete ./-teapotPhotoFile } -result {} test imgPhoto-4.76 {ImgPhotoCmd procedure: copy to same image} -constraints { hasTeapotPhoto } -setup { imageCleanup image create photo photo1 -file $teapotPhotoFile } -body { # non-regression test for bug [5239fd749b] - shall just not crash photo1 copy photo1 -to 0 0 2000 1000 photo1 copy photo1 -subsample 2 2 -shrink } -cleanup { imageCleanup } -result {} test imgPhoto-5.1 {ImgPhotoGet/Free procedures, shared instances} -constraints { hasTeapotPhoto } -setup { destroy .c pack [canvas .c] |
︙ | ︙ |
Changes to tests/menu.test.
︙ | ︙ | |||
275 276 277 278 279 280 281 | # We need to test all of the options with all of the different types of # menu entries. The following code sets up .m1 with 6 items. It then # runs through the 2.31 - 2.228 tests below # index 0 is tearoff, 1 command, 2 cascade, 3 separator, 4 checkbutton, # 5 radiobutton deleteWindows | | | | 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | # We need to test all of the options with all of the different types of # menu entries. The following code sets up .m1 with 6 items. It then # runs through the 2.31 - 2.228 tests below # index 0 is tearoff, 1 command, 2 cascade, 3 separator, 4 checkbutton, # 5 radiobutton deleteWindows menu .m1 -tearoff 1 .m1 add command -label "command" menu .m2 -tearoff 1 .m2 add command -label "test" .m1 add cascade -label "cascade" -menu .m2 .m1 add separator .m1 add checkbutton -label "checkbutton" -variable check -onvalue on -offvalue off .m1 add radiobutton -label "radiobutton" -variable radio if {[testConstraint hasEarthPhoto]} { |
︙ | ︙ | |||
1394 1395 1396 1397 1398 1399 1400 | } -body { menu .m1 .m1 delete foo } -returnCodes error -result {bad menu entry index "foo"} test menu-3.24 {MenuWidgetCmd procedure, "delete" option} -setup { destroy .m1 } -body { | | | 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 | } -body { menu .m1 .m1 delete foo } -returnCodes error -result {bad menu entry index "foo"} test menu-3.24 {MenuWidgetCmd procedure, "delete" option} -setup { destroy .m1 } -body { menu .m1 -tearoff 1 .m1 delete 0 "foo" } -returnCodes error -result {bad menu entry index "foo"} test menu-3.25 {MenuWidgetCmd procedure, "delete" option} -setup { destroy .m1 } -body { menu .m1 .m1 delete 0 |
︙ | ︙ | |||
1542 1543 1544 1545 1546 1547 1548 | } -body { menu .m1 .m1 index foo } -returnCodes error -result {bad menu entry index "foo"} test menu-3.41 {MenuWidgetCmd procedure, "index" option} -setup { destroy .m1 } -body { | | | 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 | } -body { menu .m1 .m1 index foo } -returnCodes error -result {bad menu entry index "foo"} test menu-3.41 {MenuWidgetCmd procedure, "index" option} -setup { destroy .m1 } -body { menu .m1 -tearoff 1 .m1 add command -label "test" .m1 add command -label "3" .m1 add command -label "another label" .m1 add command -label "end" .m1 add command -label "3a" .m1 add command -label "final entry" list [.m1 index "test"] [.m1 index "3"] [.m1 index "3a"] [.m1 index "end"] |
︙ | ︙ | |||
1735 1736 1737 1738 1739 1740 1741 | .m1 type 1 } -cleanup { destroy .m1 } -result {cascade} test menu-3.62 {MenuWidgetCmd procedure, "type" option} -setup { destroy .m1 } -body { | | | 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 | .m1 type 1 } -cleanup { destroy .m1 } -result {cascade} test menu-3.62 {MenuWidgetCmd procedure, "type" option} -setup { destroy .m1 } -body { menu .m1 -tearoff 1 .m1 type 0 } -cleanup { destroy .m1 } -result {tearoff} test menu-3.63 {MenuWidgetCmd procedure, "unpost" option} -setup { destroy .m1 } -body { |
︙ | ︙ | |||
1768 1769 1770 1771 1772 1773 1774 | destroy .m1 } -body { menu .m1 .m1 yposition } -cleanup { destroy .m1 } -returnCodes error -result {wrong # args: should be ".m1 yposition index"} | | | > > > > > > > > > > > > > > > > > > > > > > > > | 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 1805 1806 1807 1808 1809 1810 1811 1812 1813 | destroy .m1 } -body { menu .m1 .m1 yposition } -cleanup { destroy .m1 } -returnCodes error -result {wrong # args: should be ".m1 yposition index"} test menu-3.66a {MenuWidgetCmd procedure, "yposition" option, no tearoff} -setup { destroy .m1 } -body { menu .m1 -tearoff 0 .m1 yposition 1 } -cleanup { destroy .m1 } -result {0} test menu-3.66b {MenuWidgetCmd procedure, "yposition" option, with tearoff} -constraints { notAqua } -setup { destroy .m1 } -body { # on Win or Linux, tearoff menus are supported # see menu-3.66c for aqua menu .m1 -tearoff 1 .m1 yposition 1 } -cleanup { destroy .m1 } -result {1} test menu-3.66c {MenuWidgetCmd procedure, "yposition" option, with tearoff} -constraints { aqua } -setup { destroy .m1 } -body { # on OS X, tearoff menus are not supported # see menu-3.66b for win or linux menu .m1 -tearoff 1 .m1 yposition 1 } -cleanup { destroy .m1 } -result {0} test menu-3.67 {MenuWidgetCmd procedure, bad option} -setup { destroy .m1 } -body { menu .m1 .m1 foo } -cleanup { destroy .m1 |
︙ | ︙ | |||
1879 1880 1881 1882 1883 1884 1885 | } -cleanup { destroy .m1 } -result {0 {} 0 on 0 {}} test menu-4.6 {TkInvokeMenu: radiobutton} -setup { destroy .m1 } -body { catch {unset foo} | | | | 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 | } -cleanup { destroy .m1 } -result {0 {} 0 on 0 {}} test menu-4.6 {TkInvokeMenu: radiobutton} -setup { destroy .m1 } -body { catch {unset foo} menu .m1 -tearoff 1 .m1 add radiobutton -label "1" -variable foo -value one .m1 add radiobutton -label "2" -variable foo -value two .m1 add radiobutton -label "3" -variable foo -value three list [catch {.m1 invoke 1} msg] $msg [catch {set foo} msg2] $msg2 [catch {unset foo} msg3] $msg3 } -cleanup { destroy .m1 } -result {0 {} 0 one 0 {}} test menu-4.7 {TkInvokeMenu: radiobutton} -setup { destroy .m1 } -body { catch {unset foo} menu .m1 -tearoff 1 .m1 add radiobutton -label "1" -variable foo -value one .m1 add radiobutton -label "2" -variable foo -value two .m1 add radiobutton -label "3" -variable foo -value three list [catch {.m1 invoke 2} msg] $msg [catch {set foo} msg2] $msg2 [catch {unset foo} msg3] $msg3 } -cleanup { destroy .m1 } -result {0 {} 0 two 0 {}} |
︙ | ︙ | |||
1945 1946 1947 1948 1949 1950 1951 | list [catch {.m1 invoke 1} msg] $msg } -cleanup { destroy .m1 } -result {0 {}} test menu-4.12 {TkInvokeMenu} -setup { destroy .m1 } -body { | | | 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 | list [catch {.m1 invoke 1} msg] $msg } -cleanup { destroy .m1 } -result {0 {}} test menu-4.12 {TkInvokeMenu} -setup { destroy .m1 } -body { menu .m1 -tearoff 1 .m1 add command -label "test" -command ".m1 delete 1" list [catch {.m1 invoke 1} msg] $msg [catch {.m1 type "test"} msg2] $msg2 } -cleanup { destroy .m1 } -result {0 {} 1 {bad menu entry index "test"}} test menu-5.1 {DestroyMenuInstance} -setup { |
︙ | ︙ | |||
2333 2334 2335 2336 2337 2338 2339 | menu .m1 .m1 add command -label "test" list [.m1 delete 1] [destroy .m1] } -result {{} {}} test menu-8.6 {DestroyMenuEntry} -setup { destroy .m1 } -body { | | | 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 | menu .m1 .m1 add command -label "test" list [.m1 delete 1] [destroy .m1] } -result {{} {}} test menu-8.6 {DestroyMenuEntry} -setup { destroy .m1 } -body { menu .m1 -tearoff 1 .m1 add command -label "one" .m1 add command -label "two" list [.m1 delete 1] [.m1 entrycget 1 -label] [destroy .m1] } -result {{} two {}} test menu-8.7 {DestroyMenuEntry} -setup { deleteWindows } -body { |
︙ | ︙ | |||
2733 2734 2735 2736 2737 2738 2739 | deleteWindows } -result {} test menu-13.1 {TkGetMenuIndex} -setup { deleteWindows } -body { | | | 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 | deleteWindows } -result {} test menu-13.1 {TkGetMenuIndex} -setup { deleteWindows } -body { menu .m1 -tearoff 1 .m1 add command -label "active" .m1 add command -label "test2" .m1 add command -label "test3" .m1 activate 2 .m1 entrycget active -label } -cleanup { deleteWindows |
︙ | ︙ | |||
2800 2801 2802 2803 2804 2805 2806 | } -cleanup { deleteWindows } -result {} #test menu-13.7 - Need to add @test here. test menu-13.7 {TkGetMenuIndex} -setup { deleteWindows } -body { | | | 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 | } -cleanup { deleteWindows } -result {} #test menu-13.7 - Need to add @test here. test menu-13.7 {TkGetMenuIndex} -setup { deleteWindows } -body { menu .m1 -tearoff 1 .m1 add command -label "active" .m1 add command -label "test2" .m1 add command -label "test3" .m1 entrycget 1 -label } -cleanup { deleteWindows } -result {active} |
︙ | ︙ | |||
2933 2934 2935 2936 2937 2938 2939 | } -body { menu .m1 .m1 insert -1 command -label "test" } -returnCodes error -result {bad menu entry index "-1"} test menu-16.4 {MenuAddOrInsert} -setup { deleteWindows } -body { | | | 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 | } -body { menu .m1 .m1 insert -1 command -label "test" } -returnCodes error -result {bad menu entry index "-1"} test menu-16.4 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 -tearoff 1 .m1 add command -label "test" .m1 insert 0 command -label "test2" .m1 entrycget 1 -label } -cleanup { deleteWindows } -result {test2} test menu-16.5 {MenuAddOrInsert} -setup { |
︙ | ︙ | |||
3273 3274 3275 3276 3277 3278 3279 | .m1 clone .foo } -cleanup { deleteWindows } -result {} test menu-20.10 {CloneMenu - tearoff fields} -setup { deleteWindows } -body { | | | 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 | .m1 clone .foo } -cleanup { deleteWindows } -result {} test menu-20.10 {CloneMenu - tearoff fields} -setup { deleteWindows } -body { menu .m1 -tearoff 1 list [.m1 clone .m2 normal] [.m2 cget -tearoff] } -cleanup { deleteWindows } -result {{} 1} test menu-20.11 {CloneMenu} -setup { deleteWindows } -body { |
︙ | ︙ | |||
3324 3325 3326 3327 3328 3329 3330 | .m1 configure -tearoff 0 .m1 index @5,5 } -cleanup { deleteWindows } -result {0} test menu-22.3 {GetIndexFromCoords: mapped window, y only} -setup { deleteWindows | | | | | 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 | .m1 configure -tearoff 0 .m1 index @5,5 } -cleanup { deleteWindows } -result {0} test menu-22.3 {GetIndexFromCoords: mapped window, y only} -setup { deleteWindows } -constraints {x11} -body { menu .m1 .m1 add command -label "test" .m1 configure -tearoff 0 tk_popup .m1 0 0 tkwait visibility .m1 .m1 index @5 } -cleanup { deleteWindows } -result {0} test menu-22.4 {GetIndexFromCoords: mapped window x,y} -setup { deleteWindows } -constraints {x11} -body { menu .m1 .m1 add command -label "test" .m1 configure -tearoff 0 tk_popup .m1 0 0 tkwait visibility .m1 update set x [expr {[winfo width .m1] - [.m1 cget -borderwidth] - 1}] .m1 index @$x,5 } -cleanup { deleteWindows } -result {0} test menu-22.5 {GetIndexFromCoords: mapped wide window} -setup { deleteWindows } -constraints {x11} -body { menu .m1 .m1 add command -label "test" .m1 configure -tearoff 0 tk_popup .m1 0 0 tkwait visibility .m1 wm geometry .m1 200x100 update |
︙ | ︙ |
Changes to tests/menuDraw.test.
︙ | ︙ | |||
643 644 645 646 647 648 649 | menu .m1 .m1 add cascade -label test set tearoff [tk::TearOffMenu .m1 40 40] $tearoff postcascade 0 } -cleanup { deleteWindows } -result {} | | | 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 | menu .m1 .m1 add cascade -label test set tearoff [tk::TearOffMenu .m1 40 40] $tearoff postcascade 0 } -cleanup { deleteWindows } -result {} test menuDraw-16.5 {TkPostSubMenu} -setup { deleteWindows } -body { menu .m1 .m1 add cascade -label test -menu .m2 menu .m2 -postcommand "glorp" set tearoff [tk::TearOffMenu .m1 40 40] $tearoff postcascade test |
︙ | ︙ |
Changes to tests/packgrid.test.
︙ | ︙ | |||
241 242 243 244 245 246 247 248 249 250 | pack .g pack .p grid .g } -returnCodes error -cleanup { destroy .p destroy .g } -result {cannot use geometry manager grid inside . which already has slaves managed by pack} cleanupTests return | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 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 | pack .g pack .p grid .g } -returnCodes error -cleanup { destroy .p destroy .g } -result {cannot use geometry manager grid inside . which already has slaves managed by pack} test packgrid-4.1 {slave stolen after master destruction - bug [aa7679685e]} -setup { frame .f button .b -text hello } -body { pack .f grid .b -in .f destroy .f set res [winfo manager .b] # shall not crash pack .b set res } -cleanup { destroy .b } -result {} test packgrid-4.2 {slave stolen after master destruction - bug [aa7679685e]} -setup { frame .f button .b -text hello } -body { pack .f pack .b -in .f destroy .f set res [winfo manager .b] # shall not crash grid .b set res } -cleanup { destroy .b } -result {} cleanupTests return |
Added tests/safePrimarySelection.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 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 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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 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 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 249 250 251 252 253 254 255 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 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 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 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 521 522 523 524 525 526 527 528 529 530 531 532 533 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 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 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 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 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 746 747 748 749 750 751 752 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 856 857 858 859 860 861 862 863 864 865 866 867 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 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 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 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 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 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 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 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 | # This file is a Tcl script to test entry widgets in Tk. It is # organized in the standard fashion for Tcl tests. # # Copyright (c) 1994 The Regents of the University of California. # Copyright (c) 1994-1997 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands # ------------------------------------------------------------------------------ # Tests that a Safe Base interpreter cannot write to the PRIMARY selection. # ------------------------------------------------------------------------------ # - Tests 3.*, 6.* test that the fix for ticket de156e9efe implemented in branch # bug-de156e9efe has been applied and still works. They test that a Safe Base # slave interpreter cannot write to the PRIMARY selection. # - The other tests verify that the master interpreter and an unsafe slave CAN # write to the PRIMARY selection, and therefore that the test scripts # themselves are valid. # - A text, entry, ttk::entry, listbox, spinbox or ttk::spinbox widget can have # option -exportselection 1, meaning (in an unsafe interpreter) that a # selection made in one of these widgets is automatically written to the # PRIMARY selection. # - A safe interpreter must not write to the PRIMARY selection. # - The spinbox, ttk::spinbox are variants of entry, ttk::entry respectively. # ------------------------------------------------------------------------------ namespace eval ::_test_tmp {} # ------------------------------------------------------------------------------ # Proc ::_test_tmp::unsafeInterp # ------------------------------------------------------------------------------ # Command that creates an unsafe child interpreter and tries to load Tk. # - This is necessary for loading Tk if the tests are done in the build # directory without installing Tk. In that case the usual auto_path loading # mechanism cannot work because the tk binary is not where pkgIndex.tcl says # it is. # - This command is not needed for Safe Base slaves because safe::loadTk does # something similar and works correctly. # - Based on scripts in winSend.test. # ------------------------------------------------------------------------------ namespace eval ::_test_tmp { variable TkLoadCmd } foreach pkg [info loaded] { if {[lindex $pkg 1] eq "Tk"} { set ::_test_tmp::TkLoadCmd [list load {*}$pkg] break } } proc ::_test_tmp::unsafeInterp {name} { variable TkLoadCmd interp create $name $name eval [list set argv [list -name $name]] catch {{*}$TkLoadCmd $name} } set ::_test_tmp::script { package require Tk namespace eval ::_test_tmp {} proc ::_test_tmp::getPrimarySelection {} { if {[catch {::tk::GetSelection . PRIMARY} sel]} { set sel {} } return $sel } proc ::_test_tmp::setPrimarySelection {} { destroy .preset text .preset -exportselection 1 .preset insert end OLD_VALUE # pack .preset .preset tag add sel 1.0 end-1c update return } # Clearing the PRIMARY selection is troublesome. # The window need not be mapped. # However, the window must continue to exist, or some X11 servers # will set the PRIMARY selection to something else. proc ::_test_tmp::clearPrimarySelection {} { destroy .clear text .clear -exportselection 1 .clear insert end TMP_VALUE # pack .clear .clear tag add sel 1.0 end-1c update .clear tag remove sel 1.0 end-1c update return } # If this interpreter can write to the PRIMARY # selection, the commands below will do so. proc ::_test_tmp::tryText {} { text .t -exportselection 1 .t insert end PAYLOAD pack .t .t tag add sel 1.0 end-1c update return } proc ::_test_tmp::tryEntry {} { entry .t -exportselection 1 .t insert end PAYLOAD pack .t .t selection range 0 end update return } proc ::_test_tmp::tryTtkEntry {} { ::ttk::entry .t -exportselection 1 .t insert end PAYLOAD pack .t .t selection range 0 end update return } proc ::_test_tmp::tryListbox {} { listbox .t -exportselection 1 .t insert end list1 PAYLOAD list3 pack .t .t selection set 1 update return } proc ::_test_tmp::trySpinbox {ver} { if {$ver == 1} { # spinbox as entry spinbox .t -exportselection 1 -values {1 2 3 4 5} .t delete 0 end .t insert end PAYLOAD pack .t .t selection range 0 end update return # selects PAYLOAD } elseif {$ver == 2} { # spinbox spun spinbox .t -exportselection 1 -values {1 2 3 4 5} .t invoke buttonup pack .t .t selection range 0 end update return # selects 2 } else { # spinbox spun/selected/spun spinbox .t -exportselection 1 -values {1 2 3 4 5} .t invoke buttonup pack .t .t selection range 0 end update .t invoke buttonup update return # selects 3 } } proc ::_test_tmp::tryTtkSpinbox {ver} { if {$ver == 1} { # ttk::spinbox as entry ::ttk::spinbox .t -exportselection 1 -values {1 2 3 4 5} .t delete 0 end .t insert end PAYLOAD pack .t .t selection range 0 end update return } elseif {$ver == 2} { # ttk::spinbox spun ::ttk::spinbox .t -exportselection 1 -values {1 2 3 4 5} ::ttk::spinbox::Spin .t +1 ::ttk::spinbox::Spin .t +1 pack .t # ttk::spinbox::Spin sets selection update return # selects 2 } else { # ttk::spinbox spun/selected/spun ::ttk::spinbox .t -exportselection 1 -values {1 2 3 4 5} ::ttk::spinbox::Spin .t +1 ::ttk::spinbox::Spin .t +1 pack .t # ttk::spinbox::Spin sets selection update ::ttk::spinbox::Spin .t +1 update return # selects 3 } } } # Do this once for the master interpreter. eval $::_test_tmp::script test safePrimarySelection-1.1 {master interpreter, text, no existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { ::_test_tmp::tryText ::_test_tmp::getPrimarySelection } -cleanup { destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} test safePrimarySelection-1.2 {master interpreter, entry, no existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { ::_test_tmp::tryEntry ::_test_tmp::getPrimarySelection } -cleanup { destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} test safePrimarySelection-1.3 {master interpreter, ttk::entry, no existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { ::_test_tmp::tryTtkEntry ::_test_tmp::getPrimarySelection } -cleanup { destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} test safePrimarySelection-1.4 {master interpreter, listbox, no existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { ::_test_tmp::tryListbox ::_test_tmp::getPrimarySelection } -cleanup { destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} test safePrimarySelection-1.5 {master interpreter, spinbox as entry, no existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { ::_test_tmp::trySpinbox 1 ::_test_tmp::getPrimarySelection } -cleanup { destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} test safePrimarySelection-1.6 {master interpreter, spinbox spun, no existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { ::_test_tmp::trySpinbox 2 ::_test_tmp::getPrimarySelection } -cleanup { destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -result {2} test safePrimarySelection-1.7 {master interpreter, spinbox spun/selected/spun, no existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { ::_test_tmp::trySpinbox 3 ::_test_tmp::getPrimarySelection } -cleanup { destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -result {3} test safePrimarySelection-1.8 {master interpreter, ttk::spinbox as entry, no existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { ::_test_tmp::tryTtkSpinbox 1 ::_test_tmp::getPrimarySelection } -cleanup { destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} test safePrimarySelection-1.9 {master interpreter, ttk::spinbox spun, no existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { ::_test_tmp::tryTtkSpinbox 2 ::_test_tmp::getPrimarySelection } -cleanup { destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -result {2} test safePrimarySelection-1.10 {master interpreter, ttk::spinbox spun/selected/spun, no existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { ::_test_tmp::tryTtkSpinbox 3 ::_test_tmp::getPrimarySelection } -cleanup { destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -result {3} test safePrimarySelection-2.1 {unsafe slave interpreter, text, no existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { set int2 slave2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryText $int2 eval ::_test_tmp::getPrimarySelection } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} test safePrimarySelection-2.2 {unsafe slave interpreter, entry, no existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { set int2 slave2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryEntry $int2 eval ::_test_tmp::getPrimarySelection } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} test safePrimarySelection-2.3 {unsafe slave interpreter, ttk::entry, no existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { set int2 slave2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryTtkEntry $int2 eval ::_test_tmp::getPrimarySelection } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} test safePrimarySelection-2.4 {unsafe slave interpreter, listbox, no existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { set int2 slave2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryListbox $int2 eval ::_test_tmp::getPrimarySelection } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} test safePrimarySelection-2.5 {unsafe slave interpreter, spinbox as entry, no existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { set int2 slave2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::trySpinbox 1 $int2 eval ::_test_tmp::getPrimarySelection } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} test safePrimarySelection-2.6 {unsafe slave interpreter, spinbox spun, no existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { set int2 slave2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::trySpinbox 2 $int2 eval ::_test_tmp::getPrimarySelection } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 ::_test_tmp::clearPrimarySelection } -result {2} test safePrimarySelection-2.7 {unsafe slave interpreter, spinbox spun/selected/spun, no existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { set int2 slave2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::trySpinbox 3 $int2 eval ::_test_tmp::getPrimarySelection } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 ::_test_tmp::clearPrimarySelection } -result {3} test safePrimarySelection-2.8 {unsafe slave interpreter, ttk::spinbox as entry, no existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { set int2 slave2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryTtkSpinbox 1 $int2 eval ::_test_tmp::getPrimarySelection } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} test safePrimarySelection-2.9 {unsafe slave interpreter, ttk::spinbox spun, no existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { set int2 slave2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryTtkSpinbox 2 $int2 eval ::_test_tmp::getPrimarySelection } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 ::_test_tmp::clearPrimarySelection } -result {2} test safePrimarySelection-2.10 {unsafe slave interpreter, ttk::spinbox spun/selected/spun, no existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { set int2 slave2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryTtkSpinbox 3 $int2 eval ::_test_tmp::getPrimarySelection } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 ::_test_tmp::clearPrimarySelection } -result {3} test safePrimarySelection-3.1 {IMPORTANT, safe slave interpreter, text, no existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] set int2 slave2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryText set res1 [$int2 eval ::_test_tmp::getPrimarySelection] set res2 [::_test_tmp::getPrimarySelection] set res3 $res0--$res1--$res2 } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 res0 res1 res2 res3 ::_test_tmp::clearPrimarySelection } -result {----} test safePrimarySelection-3.2 {IMPORTANT, safe slave interpreter, entry, no existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] set int2 slave2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryEntry set res1 [$int2 eval ::_test_tmp::getPrimarySelection] set res2 [::_test_tmp::getPrimarySelection] set res3 $res0--$res1--$res2 } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 res0 res1 res2 res3 ::_test_tmp::clearPrimarySelection } -result {----} test safePrimarySelection-3.3 {IMPORTANT, safe slave interpreter, ttk::entry, no existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] set int2 slave2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryTtkEntry set res1 [$int2 eval ::_test_tmp::getPrimarySelection] set res2 [::_test_tmp::getPrimarySelection] set res3 $res0--$res1--$res2 } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 res0 res1 res2 res3 ::_test_tmp::clearPrimarySelection } -result {----} test safePrimarySelection-3.4 {IMPORTANT, safe slave interpreter, listbox, no existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] set int2 slave2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryListbox set res1 [$int2 eval ::_test_tmp::getPrimarySelection] set res2 [::_test_tmp::getPrimarySelection] set res3 $res0--$res1--$res2 } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 res0 res1 res2 res3 ::_test_tmp::clearPrimarySelection } -result {----} test safePrimarySelection-3.5 {IMPORTANT, safe slave interpreter, spinbox as entry, no existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] set int2 slave2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::trySpinbox 1 set res1 [$int2 eval ::_test_tmp::getPrimarySelection] set res2 [::_test_tmp::getPrimarySelection] set res3 $res0--$res1--$res2 } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 res0 res1 res2 res3 ::_test_tmp::clearPrimarySelection } -result {----} test safePrimarySelection-3.6 {IMPORTANT, safe slave interpreter, spinbox spun, no existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] set int2 slave2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::trySpinbox 2 set res1 [$int2 eval ::_test_tmp::getPrimarySelection] set res2 [::_test_tmp::getPrimarySelection] set res3 $res0--$res1--$res2 } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 res0 res1 res2 res3 ::_test_tmp::clearPrimarySelection } -result {----} test safePrimarySelection-3.7 {IMPORTANT, safe slave interpreter, spinbox spun/selected/spun, no existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] set int2 slave2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::trySpinbox 3 set res1 [$int2 eval ::_test_tmp::getPrimarySelection] set res2 [::_test_tmp::getPrimarySelection] set res3 $res0--$res1--$res2 } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 res0 res1 res2 res3 ::_test_tmp::clearPrimarySelection } -result {----} test safePrimarySelection-3.8 {IMPORTANT, safe slave interpreter, ttk::spinbox as entry, no existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] set int2 slave2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryTtkSpinbox 1 set res1 [$int2 eval ::_test_tmp::getPrimarySelection] set res2 [::_test_tmp::getPrimarySelection] set res3 $res0--$res1--$res2 } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 res0 res1 res2 res3 ::_test_tmp::clearPrimarySelection } -result {----} test safePrimarySelection-3.9 {IMPORTANT, safe slave interpreter, ttk::spinbox spun, no existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] set int2 slave2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryTtkSpinbox 2 set res1 [$int2 eval ::_test_tmp::getPrimarySelection] set res2 [::_test_tmp::getPrimarySelection] set res3 $res0--$res1--$res2 } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 res0 res1 res2 res3 ::_test_tmp::clearPrimarySelection } -result {----} test safePrimarySelection-3.10 {IMPORTANT, safe slave interpreter, ttk::spinbox spun/selected/spun, no existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] set int2 slave2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryTtkSpinbox 3 set res1 [$int2 eval ::_test_tmp::getPrimarySelection] set res2 [::_test_tmp::getPrimarySelection] set res3 $res0--$res1--$res2 } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 res0 res1 res2 res3 ::_test_tmp::clearPrimarySelection } -result {----} test safePrimarySelection-4.1 {master interpreter, text, existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { ::_test_tmp::tryText ::_test_tmp::getPrimarySelection } -cleanup { destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} test safePrimarySelection-4.2 {master interpreter, entry, existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { ::_test_tmp::tryEntry ::_test_tmp::getPrimarySelection } -cleanup { destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} test safePrimarySelection-4.3 {master interpreter, ttk::entry, existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { ::_test_tmp::tryTtkEntry ::_test_tmp::getPrimarySelection } -cleanup { destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} test safePrimarySelection-4.4 {master interpreter, listbox, existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { ::_test_tmp::tryListbox ::_test_tmp::getPrimarySelection } -cleanup { destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} test safePrimarySelection-4.5 {master interpreter, spinbox as entry, existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { ::_test_tmp::trySpinbox 1 ::_test_tmp::getPrimarySelection } -cleanup { destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} test safePrimarySelection-4.6 {master interpreter, spinbox spun, existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { ::_test_tmp::trySpinbox 2 ::_test_tmp::getPrimarySelection } -cleanup { destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -result {2} test safePrimarySelection-4.7 {master interpreter, spinbox spun/selected/spun, existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { ::_test_tmp::trySpinbox 3 ::_test_tmp::getPrimarySelection } -cleanup { destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -result {3} test safePrimarySelection-4.8 {master interpreter, ttk::spinbox as entry, existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { ::_test_tmp::tryTtkSpinbox 1 ::_test_tmp::getPrimarySelection } -cleanup { destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} test safePrimarySelection-4.9 {master interpreter, ttk::spinbox spun, existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { ::_test_tmp::tryTtkSpinbox 2 ::_test_tmp::getPrimarySelection } -cleanup { destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -result {2} test safePrimarySelection-4.10 {master interpreter, ttk::spinbox spun/selected/spun, existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { ::_test_tmp::tryTtkSpinbox 3 ::_test_tmp::getPrimarySelection } -cleanup { destroy {*}[winfo children .] ::_test_tmp::clearPrimarySelection } -result {3} test safePrimarySelection-5.1 {unsafe slave interpreter, text, existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { set int2 slave2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryText $int2 eval ::_test_tmp::getPrimarySelection } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} test safePrimarySelection-5.2 {unsafe slave interpreter, entry, existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { set int2 slave2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryEntry $int2 eval ::_test_tmp::getPrimarySelection } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} test safePrimarySelection-5.3 {unsafe slave interpreter, ttk::entry, existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { set int2 slave2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryTtkEntry $int2 eval ::_test_tmp::getPrimarySelection } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} test safePrimarySelection-5.4 {unsafe slave interpreter, listbox, existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { set int2 slave2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryListbox $int2 eval ::_test_tmp::getPrimarySelection } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} test safePrimarySelection-5.5 {unsafe slave interpreter, spinbox as entry, existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { set int2 slave2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::trySpinbox 1 $int2 eval ::_test_tmp::getPrimarySelection } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} test safePrimarySelection-5.6 {unsafe slave interpreter, spinbox spun, existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { set int2 slave2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::trySpinbox 2 $int2 eval ::_test_tmp::getPrimarySelection } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 ::_test_tmp::clearPrimarySelection } -result {2} test safePrimarySelection-5.7 {unsafe slave interpreter, spinbox spun/selected/spun, existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { set int2 slave2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::trySpinbox 3 $int2 eval ::_test_tmp::getPrimarySelection } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 ::_test_tmp::clearPrimarySelection } -result {3} test safePrimarySelection-5.8 {unsafe slave interpreter, ttk::spinbox as entry, existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { set int2 slave2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryTtkSpinbox 1 $int2 eval ::_test_tmp::getPrimarySelection } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 ::_test_tmp::clearPrimarySelection } -result {PAYLOAD} test safePrimarySelection-5.9 {unsafe slave interpreter, ttk::spinbox spun, existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { set int2 slave2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryTtkSpinbox 2 $int2 eval ::_test_tmp::getPrimarySelection } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 ::_test_tmp::clearPrimarySelection } -result {2} test safePrimarySelection-5.10 {unsafe slave interpreter, ttk::spinbox spun/selected/spun, existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { set int2 slave2 ::_test_tmp::unsafeInterp $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryTtkSpinbox 3 $int2 eval ::_test_tmp::getPrimarySelection } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 ::_test_tmp::clearPrimarySelection } -result {3} test safePrimarySelection-6.1 {IMPORTANT, safe slave interpreter, text, existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] set int2 slave2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryText set res1 [$int2 eval ::_test_tmp::getPrimarySelection] set res2 [::_test_tmp::getPrimarySelection] set res3 $res0--$res1--$res2 } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 res0 res1 res2 res3 ::_test_tmp::clearPrimarySelection } -result {OLD_VALUE----OLD_VALUE} test safePrimarySelection-6.2 {IMPORTANT, safe slave interpreter, entry, existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] set int2 slave2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryEntry set res1 [$int2 eval ::_test_tmp::getPrimarySelection] set res2 [::_test_tmp::getPrimarySelection] set res3 $res0--$res1--$res2 } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 res0 res1 res2 res3 ::_test_tmp::clearPrimarySelection } -result {OLD_VALUE----OLD_VALUE} test safePrimarySelection-6.3 {IMPORTANT, safe slave interpreter, ttk::entry, existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] set int2 slave2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryTtkEntry set res1 [$int2 eval ::_test_tmp::getPrimarySelection] set res2 [::_test_tmp::getPrimarySelection] set res3 $res0--$res1--$res2 } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 res0 res1 res2 res3 ::_test_tmp::clearPrimarySelection } -result {OLD_VALUE----OLD_VALUE} test safePrimarySelection-6.4 {IMPORTANT, safe slave interpreter, listbox, existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] set int2 slave2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryListbox set res1 [$int2 eval ::_test_tmp::getPrimarySelection] set res2 [::_test_tmp::getPrimarySelection] set res3 $res0--$res1--$res2 } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 res0 res1 res2 res3 ::_test_tmp::clearPrimarySelection } -result {OLD_VALUE----OLD_VALUE} test safePrimarySelection-6.5 {IMPORTANT, safe slave interpreter, spinbox as entry, existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] set int2 slave2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::trySpinbox 1 set res1 [$int2 eval ::_test_tmp::getPrimarySelection] set res2 [::_test_tmp::getPrimarySelection] set res3 $res0--$res1--$res2 } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 res0 res1 res2 res3 ::_test_tmp::clearPrimarySelection } -result {OLD_VALUE----OLD_VALUE} test safePrimarySelection-6.6 {IMPORTANT, safe slave interpreter, spinbox spun, existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] set int2 slave2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::trySpinbox 2 set res1 [$int2 eval ::_test_tmp::getPrimarySelection] set res2 [::_test_tmp::getPrimarySelection] set res3 $res0--$res1--$res2 } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 res0 res1 res2 res3 ::_test_tmp::clearPrimarySelection } -result {OLD_VALUE----OLD_VALUE} test safePrimarySelection-6.7 {IMPORTANT, safe slave interpreter, spinbox spun/selected/spun, existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] set int2 slave2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::trySpinbox 3 set res1 [$int2 eval ::_test_tmp::getPrimarySelection] set res2 [::_test_tmp::getPrimarySelection] set res3 $res0--$res1--$res2 } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 res0 res1 res2 res3 ::_test_tmp::clearPrimarySelection } -result {OLD_VALUE----OLD_VALUE} test safePrimarySelection-6.8 {IMPORTANT, safe slave interpreter, ttk::spinbox as entry, existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] set int2 slave2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryTtkSpinbox 1 set res1 [$int2 eval ::_test_tmp::getPrimarySelection] set res2 [::_test_tmp::getPrimarySelection] set res3 $res0--$res1--$res2 } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 res0 res1 res2 res3 ::_test_tmp::clearPrimarySelection } -result {OLD_VALUE----OLD_VALUE} test safePrimarySelection-6.9 {IMPORTANT, safe slave interpreter, ttk::spinbox spun, existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] set int2 slave2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryTtkSpinbox 2 set res1 [$int2 eval ::_test_tmp::getPrimarySelection] set res2 [::_test_tmp::getPrimarySelection] set res3 $res0--$res1--$res2 } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 res0 res1 res2 res3 ::_test_tmp::clearPrimarySelection } -result {OLD_VALUE----OLD_VALUE} test safePrimarySelection-6.10 {IMPORTANT, safe slave interpreter, ttk::spinbox spun/selected/spun, existing selection} -setup { catch {interp delete slave2} destroy {*}[winfo children .] ::_test_tmp::setPrimarySelection } -body { set res0 [::_test_tmp::getPrimarySelection] set int2 slave2 ::safe::interpCreate $int2 ::safe::loadTk $int2 $int2 eval $::_test_tmp::script $int2 eval ::_test_tmp::tryTtkSpinbox 3 set res1 [$int2 eval ::_test_tmp::getPrimarySelection] set res2 [::_test_tmp::getPrimarySelection] set res3 $res0--$res1--$res2 } -cleanup { interp delete $int2 destroy {*}[winfo children .] unset int2 res0 res1 res2 res3 ::_test_tmp::clearPrimarySelection } -result {OLD_VALUE----OLD_VALUE} namespace delete ::_test_tmp # option clear # cleanup cleanupTests return |
Changes to tests/scale.test.
︙ | ︙ | |||
1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 | pack .s .s set 10 update ; # -command callback shall fire set res [list [.s get] $commandedVar] } -cleanup { destroy .s } -result {10 10} option clear # cleanup cleanupTests return | > > > > > > > > > > > > > > > > > > > > | 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 | pack .s .s set 10 update ; # -command callback shall fire set res [list [.s get] $commandedVar] } -cleanup { destroy .s } -result {10 10} test scale-21.1 {Bug [55b95f578a] - Associating variable with bignum value with scale crashes it} -setup { catch {destroy .s} } -body { pack [scale .s] set foo 5.79e99 # non-regression test for bug [55b95f578a] - shall just not crash .s configure -variable foo } -cleanup { destroy .s } -result {} test scale-21.2 {Bug [55b95f578a] again - Bignum value for -from/-to with scale crashes it} -setup { catch {destroy .s} } -body { pack [scale .s] # non-regression test for bug [55b95f578a] - shall just not crash .s configure -from -6.8e99 -to 8.8e99 } -cleanup { destroy .s } -result {} option clear # cleanup cleanupTests return |
Changes to tests/spinbox.test.
︙ | ︙ | |||
522 523 524 525 526 527 528 | } -body { .e configure -insertbackground bogus } -cleanup { destroy .e } -returnCodes {error} -result {unknown color name "bogus"} test spinbox-1.45 {configuration option: "insertborderwidth"} -setup { | | | 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 | } -body { .e configure -insertbackground bogus } -cleanup { destroy .e } -returnCodes {error} -result {unknown color name "bogus"} test spinbox-1.45 {configuration option: "insertborderwidth"} -setup { spinbox .e -borderwidth 2 -insertwidth 2 -highlightthickness 2 -font {Helvetica -12} \ -relief sunken pack .e update } -body { .e configure -insertborderwidth 1.3 .e cget -insertborderwidth } -cleanup { |
︙ | ︙ | |||
2847 2848 2849 2850 2851 2852 2853 | .e select from 1 .e select to 6 list [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {1 6} | | | | | 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 | .e select from 1 .e select to 6 list [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {1 6} test spinbox-13.10 {GetSpinboxIndex procedure} -constraints x11 -body { # On unix, when selection is cleared, spinbox widget's internal # selection range is reset. # Previous settings: spinbox .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e .e insert 0 012345678901234567890 .e xview 4 update .e select from 1 .e select to 6 list [.e index sel.first] [.e index sel.last] # Testing: selection clear .e .e index sel.first } -cleanup { destroy .e } -returnCodes error -result {selection isn't in widget .e} test spinbox-13.11 {GetSpinboxIndex procedure} -constraints aquaOrWin32 -body { # On mac and pc, when selection is cleared, spinbox widget remembers # last selected range. When selection ownership is restored to # spinbox, the old range will be rehighlighted. # Previous settings: spinbox .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e .e insert 0 012345678901234567890 .e xview 4 update .e select from 1 .e select to 6 list [.e index sel.first] [.e index sel.last] # Testing: selection clear .e catch {selection get} .e index sel.first } -cleanup { destroy .e } -result {1} test spinbox-13.12 {GetSpinboxIndex procedure} -constraints x11 -body { # Previous settings: spinbox .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e .e insert 0 012345678901234567890 .e xview 4 update .e select from 1 |
︙ | ︙ |
Changes to tests/text.test.
︙ | ︙ | |||
6391 6392 6393 6394 6395 6396 6397 | .t insert end "This increments ::retval once for each peer, i.e. twice." .t edit modified 0 ; # shall increment twice as well, not just once update set ::retval } -cleanup { destroy .t .tt } -result {4} | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 | .t insert end "This increments ::retval once for each peer, i.e. twice." .t edit modified 0 ; # shall increment twice as well, not just once update set ::retval } -cleanup { destroy .t .tt } -result {4} test text-27.15 {<<Selection>> virtual event on sel tagging} -body { set ::retval no_selection pack [text .t] bind .t <<Selection>> "set ::retval selection_changed" update idletasks .t insert end "nothing special\n" .t tag add sel 1.0 1.1 update set ::retval } -cleanup { destroy .t } -result {selection_changed} test text-27.15a {<<Selection>> virtual event on sel removal} -body { set ::retval no_selection pack [text .t] .t insert end "nothing special\n" .t tag add sel 1.0 1.1 bind .t <<Selection>> "set ::retval selection_changed" update idletasks .t tag remove 1.0 end update set ::retval } -cleanup { destroy .t } -result {selection_changed} test text-27.15b {<<Selection>> virtual event on <<PasteSelection>> inside widget selection} -body { pack [text .t] .t insert end "There is a selection in this text widget,\n" .t insert end "and it will be impacted by the <<PasteSelection>> event received.\n" .t insert end "Therefore a <<Selection>> event must fire back." .t tag add sel 1.0 1.28 bind .t <<Selection>> "set ::retval <<Selection>>_fired" update set ::retval no_<<Selection>>_event_fired event generate .t <<PasteSelection>> -x 15 -y 3 update set ::retval } -cleanup { destroy .t } -result {<<Selection>>_fired} test text-27.15c {No <<Selection>> virtual event on <<PasteSelection>> outside widget selection} -body { pack [text .t] .t insert end "There is a selection in this text widget,\n" .t insert end "but it will not be impacted by the <<PasteSelection>> event received." .t tag add sel 1.0 1.28 bind .t <<Selection>> "set ::retval <<Selection>>_fired" update set ::retval no_<<Selection>>_event_fired event generate .t <<PasteSelection>> -x 15 -y 80 update set ::retval } -cleanup { destroy .t } -result {no_<<Selection>>_event_fired} test text-27.15d {<<Selection>> virtual event on <Delete> with cursor inside selection} -body { pack [text .t] .t insert end "There is a selection in this text widget,\n" .t insert end "and it will be impacted by the <Delete> event received.\n" .t insert end "Therefore a <<Selection>> event must fire back." .t tag add sel 1.0 1.28 bind .t <<Selection>> "set ::retval <<Selection>>_fired" update set ::retval no_<<Selection>>_event_fired .t mark set insert 1.15 focus .t event generate .t <Delete> update set ::retval } -cleanup { destroy .t } -result {<<Selection>>_fired} test text-27.15e {No <<Selection>> virtual event on <Delete> with cursor outside selection} -body { pack [text .t] .t insert end "There is a selection in this text widget,\n" .t insert end "but it will not be impacted by the <Delete> event received." .t tag add sel 1.0 1.28 bind .t <<Selection>> "set ::retval <<Selection>>_fired" update set ::retval no_<<Selection>>_event_fired .t mark set insert 2.15 focus .t event generate .t <Delete> update set ::retval } -cleanup { destroy .t } -result {no_<<Selection>>_event_fired} test text-27.15f {<<Selection>> virtual event on <<Cut>> with a widget selection} -body { pack [text .t] .t insert end "There is a selection in this text widget,\n" .t insert end "and it will be impacted by the <<Cut>> event received.\n" .t insert end "Therefore a <<Selection>> event must fire back." .t tag add sel 1.0 1.28 bind .t <<Selection>> "set ::retval <<Selection>>_fired" update set ::retval no_<<Selection>>_event_fired event generate .t <<Cut>> update set ::retval } -cleanup { destroy .t } -result {<<Selection>>_fired} test text-27.15g {No <<Selection>> virtual event on <<Cut>> without widget selection} -body { pack [text .t] .t insert end "There is a selection in this text widget,\n" .t insert end "and it will be impacted by the <<Cut>> event received.\n" .t insert end "Therefore a <<Selection>> event must fire back." bind .t <<Selection>> "set ::retval <<Selection>>_fired" update set ::retval no_<<Selection>>_event_fired event generate .t <<Cut>> update set ::retval } -cleanup { destroy .t } -result {no_<<Selection>>_event_fired} test text-27.16 {-maxundo configuration option} -body { text .t -undo 1 -autoseparators 1 -maxundo 2 pack .t .t insert end "line 1\n" .t delete 1.4 1.6 .t insert end "line 2\n" catch {.t edit undo} |
︙ | ︙ | |||
7302 7303 7304 7305 7306 7307 7308 | set result "ok" } -cleanup { destroy .t } -result {ok} test text-36.1 "bug #1777362: event handling with hyphenated windows" -setup { | > > | > > > > > | > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > | 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 | set result "ok" } -cleanup { destroy .t } -result {ok} test text-36.1 "bug #1777362: event handling with hyphenated windows" -setup { set save [interp bgerror {}] interp bgerror {} returnerror-36.1 proc returnerror-36.1 {m opts} {set ::my_error $m} set ::my_error {} pack [set w [text .t-1]] } -body { tkwait visibility $w event generate $w <1> event generate $w <1> update set ::my_error } -cleanup { destroy .t-1 rename returnerror-36.1 "" interp bgerror {} $save unset -nocomplain save ::my_error w } -result {} test text-36.2 "bug #1777362: event handling with hyphenated windows" -setup { set save [interp bgerror {}] interp bgerror {} returnerror-36.2 proc returnerror-36.2 {m opts} {set ::my_error $m} set ::my_error {} pack [set w [text .t+1]] } -body { tkwait visibility $w event generate $w <1> event generate $w <1> update set ::my_error } -cleanup { destroy $w rename returnerror-36.2 "" interp bgerror {} $save unset -nocomplain save ::my_error w } -result {} test text-36.3 "bug #1777362: event handling with hyphenated windows" -setup { set save [interp bgerror {}] interp bgerror {} returnerror-36.3 proc returnerror-36.3 {m opts} {set ::my_error $m} set ::my_error {} pack [set w [text .t*1]] } -body { tkwait visibility $w event generate $w <1> event generate $w <1> update set ::my_error } -cleanup { destroy $w rename returnerror-36.3 "" interp bgerror {} $save unset -nocomplain save ::my_error w } -result {} test text-37.1 "bug #dd9667635d: text anchor not set" -setup { set save [interp bgerror {}] interp bgerror {} returnerror-37.1 proc returnerror-37.1 {m opts} {set ::my_error $m} destroy .t set ::my_error {} pack [text .t] } -body { .t insert end "Hello world!" .t tag add sel 1.0 end # this line shall not trigger error: # bad text index "tk::anchorN" event generate .t <<SelectPrevLine>> update set ::my_error } -cleanup { destroy .t rename returnerror-37.1 "" interp bgerror {} $save unset -nocomplain save ::my_error } -result {} # cleanup cleanupTests return # Local Variables: # mode: tcl # End: |
Changes to tests/textDisp.test.
︙ | ︙ | |||
944 945 946 947 948 949 950 951 952 953 954 955 956 957 | set scrollInfo unchanged .t insert end xxxxxxxxx\n .t insert end xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n .t insert end xxxxxxxxxxxxxxxxxxxxxxxxxx update set scrollInfo } [list 0.0 [expr {4.0/11}]] # The following group of tests is marked non-portable because # they result in a lot of extra redisplay under Ultrix. I don't # know why this is so. .t configure -bd 2 -relief raised -wrap char .t delete 1.0 end | > > > > > > > > > > > > > > > > > > > > > > | 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 | set scrollInfo unchanged .t insert end xxxxxxxxx\n .t insert end xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n .t insert end xxxxxxxxxxxxxxxxxxxxxxxxxx update set scrollInfo } [list 0.0 [expr {4.0/11}]] test textDisp-6.10 {DisplayText, redisplay embedded windows after scroll.} {aqua} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1" foreach i {2 3 4} { .t insert end "\nLine $i" } .t insert end "\n" .t window create end -create { button %W.button_one -text "Button 1"} .t insert end "\nLine 6\n" .t window create end -create { button %W.button_two -text "Button 2"} .t insert end "\nLine 8\n" .t window create end -create { button %W.button_three -text "Button 3"} update .t delete 2.0 3.0 update list $tk_textEmbWinDisplay } {{4.0 6.0}} # The following group of tests is marked non-portable because # they result in a lot of extra redisplay under Ultrix. I don't # know why this is so. .t configure -bd 2 -relief raised -wrap char .t delete 1.0 end |
︙ | ︙ |
Changes to tests/textTag.test.
︙ | ︙ | |||
1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 | test textTag-18.1 {TkTextPickCurrent tag bindings} -setup { destroy .t event generate {} <Motion> -warp 1 -x -1 -y -1; update } -body { text .t -width 30 -height 4 -relief sunken -borderwidth 10 \ -highlightthickness 10 -pady 2 pack .t .t insert end " Tag here " TAG " no tag here" .t tag configure TAG -borderwidth 4 -relief raised .t tag bind TAG <Enter> {lappend res "%x %y tag-Enter"} .t tag bind TAG <Leave> {lappend res "%x %y tag-Leave"} bind .t <Enter> {lappend res Enter} bind .t <Leave> {lappend res Leave} | > | 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 | test textTag-18.1 {TkTextPickCurrent tag bindings} -setup { destroy .t event generate {} <Motion> -warp 1 -x -1 -y -1; update } -body { text .t -width 30 -height 4 -relief sunken -borderwidth 10 \ -highlightthickness 10 -pady 2 pack .t update ; # map the window, otherwise -warp can't be done .t insert end " Tag here " TAG " no tag here" .t tag configure TAG -borderwidth 4 -relief raised .t tag bind TAG <Enter> {lappend res "%x %y tag-Enter"} .t tag bind TAG <Leave> {lappend res "%x %y tag-Leave"} bind .t <Enter> {lappend res Enter} bind .t <Leave> {lappend res Leave} |
︙ | ︙ |
Changes to tests/ttk/checkbutton.test.
︙ | ︙ | |||
56 57 58 59 60 61 62 63 64 | pack .top.mb focus -force .top.mb update event generate .top.mb <1> event generate .top.mb <ButtonRelease-1> update ; # shall not trigger error invalid command name ".top.b" } -result {} tcltest::cleanupTests | > > > > > > > > > | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | pack .top.mb focus -force .top.mb update event generate .top.mb <1> event generate .top.mb <ButtonRelease-1> update ; # shall not trigger error invalid command name ".top.b" } -result {} # Bug [fa8de77936] test checkbutton-1.8 "Empty -variable" -body { # shall simply not crash ttk::checkbutton .cbev -variable {} .cbev invoke } -cleanup { destroy .cbev } -result {} tcltest::cleanupTests |
Changes to tests/ttk/entry.test.
︙ | ︙ | |||
81 82 83 84 85 86 87 | set scrollInfo } -result {0.0 0.5} -cleanup { destroy .e } # NOTE: result can vary depending on font. # Bounding box / scrolling tests. test entry-3.0 "Series 3 setup" -body { ttk::style theme use default | | | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | set scrollInfo } -result {0.0 0.5} -cleanup { destroy .e } # NOTE: result can vary depending on font. # Bounding box / scrolling tests. test entry-3.0 "Series 3 setup" -body { ttk::style theme use default variable fixed TkFixedFont variable cw [font measure $fixed a] variable ch [font metrics $fixed -linespace] variable bd 2 ;# border + padding variable ux [font measure $fixed \u4e4e] pack [ttk::entry .e -font $fixed -width 20] update |
︙ | ︙ |
Changes to tests/ttk/scrollbar.test.
︙ | ︙ | |||
61 62 63 64 65 66 67 68 69 | test scale-1.0 "Self-destruction" -body { trace variable v w { destroy .s ;# } ttk::scale .s -variable v pack .s ; update .s set 1 ; update } -returnCodes 1 -match glob -result "*" tcltest::cleanupTests | > > > > > > > > > > > > > > > > > > > > > > > | 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 | test scale-1.0 "Self-destruction" -body { trace variable v w { destroy .s ;# } ttk::scale .s -variable v pack .s ; update .s set 1 ; update } -returnCodes 1 -match glob -result "*" test scale-2.1 "-state option" -setup { ttk::scale .s set res "" } -body { # defaults lappend res [.s instate disabled] [.s cget -state] # set -state: instate returns accordingly .s configure -state disabled lappend res [.s instate disabled] [.s cget -state] # back to normal .s configure -state normal lappend res [.s instate disabled] [.s cget -state] # use state command: -state does NOT reflect it .s state disabled lappend res [.s instate disabled] [.s cget -state] # further use state command .s state readonly lappend res [.s state] [.s cget -state] } -cleanup { destroy .s unset -nocomplain res } -result {0 normal 1 disabled 0 normal 1 normal {disabled readonly} normal} tcltest::cleanupTests |
Changes to tests/unixFont.test.
︙ | ︙ | |||
62 63 64 65 66 67 68 | set ax [winfo reqwidth .b.l] set ay [winfo reqheight .b.l] proc getsize {} { update return "[winfo reqwidth .b.l] [winfo reqheight .b.l]" } | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 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 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 249 250 251 252 253 254 255 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 | set ax [winfo reqwidth .b.l] set ay [winfo reqheight .b.l] proc getsize {} { update return "[winfo reqwidth .b.l] [winfo reqheight .b.l]" } test unixfont-1.1 {TkpGetNativeFont procedure: not native} {x11 noExceed} { list [catch {font measure {} xyz} msg] $msg } {1 {font "" doesn't exist}} test unixfont-1.2 {TkpGetNativeFont procedure: native} x11 { font measure fixed 0 } {6} test unixfont-2.1 {TkpGetFontFromAttributes procedure: no family} x11 { font actual {-size 10} set x {} } {} test unixfont-2.2 {TkpGetFontFromAttributes procedure: Times relatives} \ {x11 noExceed hasTimesNew} { set x {} lappend x [lindex [font actual {-family "Times New Roman"}] 1] lappend x [lindex [font actual {-family "New York"}] 1] lappend x [lindex [font actual {-family "Times"}] 1] } {times times times} test unixfont-2.3 {TkpGetFontFromAttributes procedure: Courier relatives} \ {x11 noExceed hasCourierNew} { set x {} lappend x [lindex [font actual {-family "Courier New"}] 1] lappend x [lindex [font actual {-family "Monaco"}] 1] lappend x [lindex [font actual {-family "Courier"}] 1] } {courier courier courier} test unixfont-2.4 {TkpGetFontFromAttributes procedure: Helvetica relatives} \ {x11 noExceed hasArial} { set x {} lappend x [lindex [font actual {-family "Arial"}] 1] lappend x [lindex [font actual {-family "Geneva"}] 1] lappend x [lindex [font actual {-family "Helvetica"}] 1] } {helvetica helvetica helvetica} test unixfont-2.5 {TkpGetFontFromAttributes procedure: fallback} x11 { font actual {-xyz-xyz-*-*-*-*-*-*-*-*-*-*-*-*} set x {} } {} test unixfont-2.6 {TkpGetFontFromAttributes: fallback to fixed family} x11 { lindex [font actual {-family fixed -size 10}] 1 } {fixed} test unixfont-2.7 {TkpGetFontFromAttributes: fixed family not available!} x11 { # no test available } {} test unixfont-2.8 {TkpGetFontFromAttributes: loop over returned font names} x11 { lindex [font actual {-family fixed -size 31}] 1 } {fixed} test unixfont-2.9 {TkpGetFontFromAttributes: reject adobe courier if possible} {x11 noExceed} { lindex [font actual {-family courier}] 1 } {courier} test unixfont-2.10 {TkpGetFontFromAttributes: scalable font found} x11 { lindex [font actual {-family courier -size 37}] 3 } {37} test unixfont-2.11 {TkpGetFontFromAttributes: font cannot be loaded} x11 { # On Linux, XListFonts() was returning names for fonts that do not # actually exist, causing the subsequent XLoadQueryFont() to fail # unexpectedly. Now falls back to another font if that happens. font actual {-size 14} set x {} } {} test unixfont-3.1 {TkpDeleteFont procedure} x11 { font actual {-family xyz} set x {} } {} test unixfont-4.1 {TkpGetFontFamilies procedure} x11 { font families set x {} } {} test unixfont-5.1 {Tk_MeasureChars procedure: no chars to be measured} x11 { .b.l config -text "000000" -wrap [expr $ax*3] .b.l config -wrap 0 } {} test unixfont-5.2 {Tk_MeasureChars procedure: no right margin} x11 { .b.l config -text "000000" } {} test unixfont-5.3 {Tk_MeasureChars procedure: loop over chars} x11 { .b.l config -text "0" .b.l config -text "\377" .b.l config -text "0\3770\377" .b.l config -text "000000000000000" } {} .b.l config -wrap [expr $ax*10] test unixfont-5.4 {Tk_MeasureChars procedure: reached right edge} x11 { .b.l config -text "0000000000000" getsize } "[expr $ax*10] [expr $ay*2]" test unixfont-5.5 {Tk_MeasureChars procedure: ran out of chars} x11 { .b.l config -text "000000" getsize } "[expr $ax*6] $ay" test unixfont-5.6 {Tk_MeasureChars procedure: find last word} x11 { .b.l config -text "000000 00000" getsize } "[expr $ax*6] [expr $ay*2]" test unixfont-5.7 {Tk_MeasureChars procedure: already saw space in line} x11 { .b.l config -text "000000 00000" getsize } "[expr $ax*6] [expr $ay*2]" test unixfont-5.8 {Tk_MeasureChars procedure: internal spaces significant} x11 { .b.l config -text "00 000 00000" getsize } "[expr $ax*7] [expr $ay*2]" test unixfont-5.9 {Tk_MeasureChars procedure: TK_PARTIAL_OK} x11 { .b.c dchars $t 0 end .b.c insert $t 0 "0000" .b.c index $t @[expr int($ax*2.5)],1 } {2} test unixfont-5.10 {Tk_MeasureChars procedure: TK_AT_LEAST_ONE} x11 { .b.l config -text "000000000000" getsize } "[expr $ax*10] [expr $ay*2]" test unixfont-5.11 {Tk_MeasureChars: TK_AT_LEAST_ONE + not even one char fit!} x11 { set a [.b.l cget -wrap] .b.l config -text "000000" -wrap 1 set x [getsize] .b.l config -wrap $a set x } "$ax [expr $ay*6]" test unixfont-5.12 {Tk_MeasureChars procedure: include eol spaces} x11 { .b.l config -text "000 \n000" getsize } "[expr $ax*6] [expr $ay*2]" test unixfont-6.1 {Tk_DrawChars procedure: loop test} x11 { .b.l config -text "a" update } {} test unixfont-6.2 {Tk_DrawChars procedure: loop test} x11 { .b.l config -text "abcd" update } {} test unixfont-6.3 {Tk_DrawChars procedure: special char} x11 { .b.l config -text "\001" update } {} test unixfont-6.4 {Tk_DrawChars procedure: normal then special} x11 { .b.l config -text "ab\001" update } {} test unixfont-6.5 {Tk_DrawChars procedure: ends with special} x11 { .b.l config -text "ab\001" update } {} test unixfont-6.6 {Tk_DrawChars procedure: more normal chars at end} x11 { .b.l config -text "ab\001def" update } {} test unixfont-7.1 {DrawChars procedure: no effects} x11 { .b.l config -text "abc" update } {} test unixfont-7.2 {DrawChars procedure: underlining} x11 { set f [.b.l cget -font] .b.l config -text "abc" -font "courier 10 underline" update .b.l config -font $f } {} test unixfont-7.3 {DrawChars procedure: overstrike} x11 { set f [.b.l cget -font] .b.l config -text "abc" -font "courier 10 overstrike" update .b.l config -font $f } {} test unixfont-8.1 {AllocFont procedure: use old font} x11 { font create xyz button .c -font xyz font configure xyz -family times update destroy .c font delete xyz } {} test unixfont-8.2 {AllocFont procedure: parse information from XLFD} x11 { expr {[lindex [font actual {-family times -size 0}] 3] == 0} } {0} test unixfont-8.3 {AllocFont procedure: can't parse info from name} x11 { catch {unset fontArray} # check that font actual returns the correct attributes. # the values of those attributes are system dependent. array set fontArray [font actual a12biluc] set result [lsort [array names fontArray]] catch {unset fontArray} set result } {-family -overstrike -size -slant -underline -weight} test unixfont-8.4 {AllocFont procedure: classify characters} x11 { set x 0 incr x [font measure $courier "\u4000"] ;# 6 incr x [font measure $courier "\002"] ;# 4 incr x [font measure $courier "\012"] ;# 2 incr x [font measure $courier "\101"] ;# 1 set x } [expr $cx*13] test unixfont-8.5 {AllocFont procedure: setup widths of normal chars} x11 { font metrics $courier -fixed } {1} test unixfont-8.6 {AllocFont procedure: setup widths of special chars} x11 { set x 0 incr x [font measure $courier "\001"] ;# 4 incr x [font measure $courier "\002"] ;# 4 incr x [font measure $courier "\012"] ;# 2 set x } [expr $cx*10] test unixfont-8.7 {AllocFont procedure: XA_UNDERLINE_POSITION} x11 { catch {font actual -adobe-courier-bold-i-normal--0-0-0-0-m-0-iso8859-1} set x {} } {} test unixfont-8.8 {AllocFont procedure: no XA_UNDERLINE_POSITION} x11 { catch {font actual --symbol-medium-r-normal--0-0-0-0-p-0-sun-fontspecific} set x {} } {} test unixfont-8.9 {AllocFont procedure: XA_UNDERLINE_THICKNESS} x11 { catch {font actual -adobe-courier-bold-i-normal--0-0-0-0-m-0-iso8859-1} set x {} } {} test unixfont-8.10 {AllocFont procedure: no XA_UNDERLINE_THICKNESS} x11 { catch {font actual --symbol-medium-r-normal--0-0-0-0-p-0-sun-fontspecific} set x {} } {} test unixfont-8.11 {AllocFont procedure: XA_UNDERLINE_POSITION was 0} x11 { catch {font actual -adobe-courier-bold-i-normal--0-0-0-0-m-0-iso8859-1} set x {} } {} test unixfont-9.1 {GetControlCharSubst procedure: 2 chars subst} x11 { .b.c dchars $t 0 end .b.c insert $t 0 "0\a0" set x {} lappend x [.b.c index $t @[expr $ax*0],0] lappend x [.b.c index $t @[expr $ax*1],0] lappend x [.b.c index $t @[expr $ax*2],0] lappend x [.b.c index $t @[expr $ax*3],0] } {0 1 1 2} test unixfont-9.2 {GetControlCharSubst procedure: 4 chars subst} x11 { .b.c dchars $t 0 end .b.c insert $t 0 "0\0010" set x {} lappend x [.b.c index $t @[expr $ax*0],0] lappend x [.b.c index $t @[expr $ax*1],0] lappend x [.b.c index $t @[expr $ax*2],0] lappend x [.b.c index $t @[expr $ax*3],0] |
︙ | ︙ |
Changes to unix/Makefile.in.
︙ | ︙ | |||
183 184 185 186 187 188 189 | # XStringToKeysym is plenty fast, so you needn't define REDO_KEYSYM_LOOKUP. KEYSYM_FLAGS = #KEYSYM_FLAGS = -DREDO_KEYSYM_LOOKUP # Tk does not used deprecated Tcl constructs so it should # compile fine with -DTCL_NO_DEPRECATED. To remove its own # set of deprecated code uncomment the second line. | | | | 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | # XStringToKeysym is plenty fast, so you needn't define REDO_KEYSYM_LOOKUP. KEYSYM_FLAGS = #KEYSYM_FLAGS = -DREDO_KEYSYM_LOOKUP # Tk does not used deprecated Tcl constructs so it should # compile fine with -DTCL_NO_DEPRECATED. To remove its own # set of deprecated code uncomment the second line. NO_DEPRECATED_FLAGS = #NO_DEPRECATED_FLAGS = -DTK_NO_DEPRECATED # Some versions of make, like SGI's, use the following variable to # determine which shell to use for executing commands: SHELL = @SHELL@ # BUILD_TCLSH is the fully qualified path name of the tclsh shell # in the Tcl build directory. Test that need to be run in the |
︙ | ︙ | |||
390 391 392 393 394 395 396 | tkUnixFocus.o $(FONT_OBJS) tkUnixInit.o tkUnixKey.o tkUnixMenu.o \ tkUnixMenubu.o tkUnixScale.o tkUnixScrlbr.o tkUnixSelect.o \ tkUnixSend.o tkUnixWm.o tkUnixXId.o AQUA_OBJS = tkMacOSXBitmap.o tkMacOSXButton.o tkMacOSXClipboard.o \ tkMacOSXColor.o tkMacOSXConfig.o tkMacOSXCursor.o tkMacOSXDebug.o \ tkMacOSXDialog.o tkMacOSXDraw.o tkMacOSXEmbed.o tkMacOSXEntry.o \ | | | | 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 | tkUnixFocus.o $(FONT_OBJS) tkUnixInit.o tkUnixKey.o tkUnixMenu.o \ tkUnixMenubu.o tkUnixScale.o tkUnixScrlbr.o tkUnixSelect.o \ tkUnixSend.o tkUnixWm.o tkUnixXId.o AQUA_OBJS = tkMacOSXBitmap.o tkMacOSXButton.o tkMacOSXClipboard.o \ tkMacOSXColor.o tkMacOSXConfig.o tkMacOSXCursor.o tkMacOSXDebug.o \ tkMacOSXDialog.o tkMacOSXDraw.o tkMacOSXEmbed.o tkMacOSXEntry.o \ tkMacOSXEvent.o tkMacOSXFont.o tkMacOSXHLEvents.o tkMacOSXImage.o \ tkMacOSXInit.o tkMacOSXKeyboard.o tkMacOSXKeyEvent.o tkMacOSXMenu.o \ tkMacOSXMenubutton.o tkMacOSXMenus.o tkMacOSXMouseEvent.o \ tkMacOSXNotify.o tkMacOSXRegion.o tkMacOSXScrlbr.o tkMacOSXSend.o \ tkMacOSXSubwindows.o tkMacOSXWindowEvent.o \ tkMacOSXWm.o tkMacOSXXStubs.o \ tkFileFilter.o tkMacWinMenu.o tkPointer.o tkUnix3d.o tkUnixScale.o \ xcolors.o xdraw.o xgc.o ximage.o xutil.o \ ttkMacOSXTheme.o |
︙ | ︙ | |||
515 516 517 518 519 520 521 522 523 524 525 526 527 528 | $(MAC_OSX_DIR)/tkMacOSXBitmap.c $(MAC_OSX_DIR)/tkMacOSXButton.c \ $(MAC_OSX_DIR)/tkMacOSXClipboard.c $(MAC_OSX_DIR)/tkMacOSXColor.c \ $(MAC_OSX_DIR)/tkMacOSXConfig.c $(MAC_OSX_DIR)/tkMacOSXCursor.c \ $(MAC_OSX_DIR)/tkMacOSXDebug.c $(MAC_OSX_DIR)/tkMacOSXDialog.c \ $(MAC_OSX_DIR)/tkMacOSXDraw.c $(MAC_OSX_DIR)/tkMacOSXEmbed.c \ $(MAC_OSX_DIR)/tkMacOSXEntry.c $(MAC_OSX_DIR)/tkMacOSXEvent.c \ $(MAC_OSX_DIR)/tkMacOSXFont.c $(MAC_OSX_DIR)/tkMacOSXHLEvents.c \ $(MAC_OSX_DIR)/tkMacOSXInit.c $(MAC_OSX_DIR)/tkMacOSXKeyboard.c \ $(MAC_OSX_DIR)/tkMacOSXKeyEvent.c $(MAC_OSX_DIR)/tkMacOSXMenu.c \ $(MAC_OSX_DIR)/tkMacOSXMenubutton.c $(MAC_OSX_DIR)/tkMacOSXMenus.c \ $(MAC_OSX_DIR)/tkMacOSXMouseEvent.c $(MAC_OSX_DIR)/tkMacOSXNotify.c \ $(MAC_OSX_DIR)/tkMacOSXRegion.c $(MAC_OSX_DIR)/tkMacOSXScrlbr.c \ $(MAC_OSX_DIR)/tkMacOSXSend.c $(MAC_OSX_DIR)/tkMacOSXSubwindows.c \ $(MAC_OSX_DIR)/tkMacOSXTest.c $(MAC_OSX_DIR)/tkMacOSXWindowEvent.c \ | > | 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 | $(MAC_OSX_DIR)/tkMacOSXBitmap.c $(MAC_OSX_DIR)/tkMacOSXButton.c \ $(MAC_OSX_DIR)/tkMacOSXClipboard.c $(MAC_OSX_DIR)/tkMacOSXColor.c \ $(MAC_OSX_DIR)/tkMacOSXConfig.c $(MAC_OSX_DIR)/tkMacOSXCursor.c \ $(MAC_OSX_DIR)/tkMacOSXDebug.c $(MAC_OSX_DIR)/tkMacOSXDialog.c \ $(MAC_OSX_DIR)/tkMacOSXDraw.c $(MAC_OSX_DIR)/tkMacOSXEmbed.c \ $(MAC_OSX_DIR)/tkMacOSXEntry.c $(MAC_OSX_DIR)/tkMacOSXEvent.c \ $(MAC_OSX_DIR)/tkMacOSXFont.c $(MAC_OSX_DIR)/tkMacOSXHLEvents.c \ $(MAC_OSX_DIR)/tkMacOSXImage.c \ $(MAC_OSX_DIR)/tkMacOSXInit.c $(MAC_OSX_DIR)/tkMacOSXKeyboard.c \ $(MAC_OSX_DIR)/tkMacOSXKeyEvent.c $(MAC_OSX_DIR)/tkMacOSXMenu.c \ $(MAC_OSX_DIR)/tkMacOSXMenubutton.c $(MAC_OSX_DIR)/tkMacOSXMenus.c \ $(MAC_OSX_DIR)/tkMacOSXMouseEvent.c $(MAC_OSX_DIR)/tkMacOSXNotify.c \ $(MAC_OSX_DIR)/tkMacOSXRegion.c $(MAC_OSX_DIR)/tkMacOSXScrlbr.c \ $(MAC_OSX_DIR)/tkMacOSXSend.c $(MAC_OSX_DIR)/tkMacOSXSubwindows.c \ $(MAC_OSX_DIR)/tkMacOSXTest.c $(MAC_OSX_DIR)/tkMacOSXWindowEvent.c \ |
︙ | ︙ | |||
1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 | tkMacOSXFont.o: $(MAC_OSX_DIR)/tkMacOSXFont.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXFont.c tkMacOSXHLEvents.o: $(MAC_OSX_DIR)/tkMacOSXHLEvents.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXHLEvents.c tkMacOSXInit.o: $(MAC_OSX_DIR)/tkMacOSXInit.c tkConfig.sh $(CC) -c $(CC_SWITCHES) -DTK_LIBRARY=\"${TK_LIBRARY}\" \ $(MAC_OSX_DIR)/tkMacOSXInit.c tkMacOSXKeyboard.o: $(MAC_OSX_DIR)/tkMacOSXKeyboard.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXKeyboard.c | > > > | 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 | tkMacOSXFont.o: $(MAC_OSX_DIR)/tkMacOSXFont.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXFont.c tkMacOSXHLEvents.o: $(MAC_OSX_DIR)/tkMacOSXHLEvents.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXHLEvents.c tkMacOSXImage.o: $(MAC_OSX_DIR)/tkMacOSXImage.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXImage.c tkMacOSXInit.o: $(MAC_OSX_DIR)/tkMacOSXInit.c tkConfig.sh $(CC) -c $(CC_SWITCHES) -DTK_LIBRARY=\"${TK_LIBRARY}\" \ $(MAC_OSX_DIR)/tkMacOSXInit.c tkMacOSXKeyboard.o: $(MAC_OSX_DIR)/tkMacOSXKeyboard.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXKeyboard.c |
︙ | ︙ | |||
1570 1571 1572 1573 1574 1575 1576 | cp $(TOP_DIR)/win/Makefile.in $(DISTDIR)/win cp $(TOP_DIR)/win/configure.in \ $(TOP_DIR)/win/configure \ $(TOP_DIR)/win/tkConfig.sh.in \ $(TOP_DIR)/win/aclocal.m4 $(TOP_DIR)/win/tcl.m4 \ $(DISTDIR)/win cp -p $(TOP_DIR)/win/*.[ch] $(TOP_DIR)/win/*.bat $(DISTDIR)/win | < | | 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 | cp $(TOP_DIR)/win/Makefile.in $(DISTDIR)/win cp $(TOP_DIR)/win/configure.in \ $(TOP_DIR)/win/configure \ $(TOP_DIR)/win/tkConfig.sh.in \ $(TOP_DIR)/win/aclocal.m4 $(TOP_DIR)/win/tcl.m4 \ $(DISTDIR)/win cp -p $(TOP_DIR)/win/*.[ch] $(TOP_DIR)/win/*.bat $(DISTDIR)/win cp -p $(TOP_DIR)/win/*.vc $(DISTDIR)/win cp -p $(TOP_DIR)/win/README $(DISTDIR)/win cp -p $(TOP_DIR)/license.terms $(DISTDIR)/win mkdir $(DISTDIR)/win/rc cp -p $(TOP_DIR)/win/wish.exe.manifest.in $(DISTDIR)/win/ cp -p $(TOP_DIR)/win/rc/*.{rc,cur,ico,bmp} $(DISTDIR)/win/rc mkdir $(DISTDIR)/macosx cp -p $(MAC_OSX_DIR)/GNUmakefile $(MAC_OSX_DIR)/README \ |
︙ | ︙ | |||
1645 1646 1647 1648 1649 1650 1651 | fi; \ done;) mkdir $(DISTDIR)/doc cp -p $(TOP_DIR)/license.terms $(TOP_DIR)/doc/*.[13n] \ $(TCLDIR)/doc/man.macros $(DISTDIR)/doc mkdir $(DISTDIR)/tests cp -p $(TOP_DIR)/license.terms $(TEST_DIR)/*.{test,tcl} \ | | | 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 | fi; \ done;) mkdir $(DISTDIR)/doc cp -p $(TOP_DIR)/license.terms $(TOP_DIR)/doc/*.[13n] \ $(TCLDIR)/doc/man.macros $(DISTDIR)/doc mkdir $(DISTDIR)/tests cp -p $(TOP_DIR)/license.terms $(TEST_DIR)/*.{test,tcl} \ $(TEST_DIR)/README $(TEST_DIR)/*.{gif,png,ppm,xbm} \ $(TEST_DIR)/option.file* $(DISTDIR)/tests mkdir $(DISTDIR)/tests/ttk cp -p $(TEST_DIR)/ttk/*.{test,tcl} $(DISTDIR)/tests/ttk alldist: dist rm -f $(DISTROOT)/$(DISTNAME)-src.tar.gz $(DISTROOT)/$(ZIPNAME) cd $(DISTROOT); tar cf $(DISTNAME)-src.tar $(DISTNAME); \ |
︙ | ︙ |
Changes to unix/configure.
︙ | ︙ | |||
1334 1335 1336 1337 1338 1339 1340 | TK_VERSION=8.6 TK_MAJOR_VERSION=8 TK_MINOR_VERSION=6 | | | 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 | TK_VERSION=8.6 TK_MAJOR_VERSION=8 TK_MINOR_VERSION=6 TK_PATCH_LEVEL=".8" VERSION=${TK_VERSION} LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv" #-------------------------------------------------------------------- # Find and load the tclConfig.sh file #-------------------------------------------------------------------- |
︙ | ︙ |
Changes to unix/configure.in.
︙ | ︙ | |||
21 22 23 24 25 26 27 | /* override */ #undef PACKAGE_TARNAME #endif /* _TKCONFIG */]) ]) TK_VERSION=8.6 TK_MAJOR_VERSION=8 TK_MINOR_VERSION=6 | | | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | /* override */ #undef PACKAGE_TARNAME #endif /* _TKCONFIG */]) ]) TK_VERSION=8.6 TK_MAJOR_VERSION=8 TK_MINOR_VERSION=6 TK_PATCH_LEVEL=".8" VERSION=${TK_VERSION} LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv" #-------------------------------------------------------------------- # Find and load the tclConfig.sh file #-------------------------------------------------------------------- |
︙ | ︙ |
Changes to unix/tk.spec.
1 2 3 4 5 6 | # This file is the basis for a binary Tk Linux RPM. %{!?directory:%define directory /usr/local} Name: tk Summary: Tk graphical toolkit for the Tcl scripting language. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # This file is the basis for a binary Tk Linux RPM. %{!?directory:%define directory /usr/local} Name: tk Summary: Tk graphical toolkit for the Tcl scripting language. Version: 8.6.8 Release: 2 License: BSD Group: Development/Languages Source: http://prdownloads.sourceforge.net/tcl/tk%{version}-src.tar.gz URL: http://www.tcl.tk/ Buildroot: /var/tmp/%{name}%{version} Buildrequires: XFree86-devel tcl >= %version |
︙ | ︙ |
Changes to unix/tkUnixKey.c.
︙ | ︙ | |||
106 107 108 109 110 111 112 | const char * TkpGetString( TkWindow *winPtr, /* Window where event occurred */ XEvent *eventPtr, /* X keyboard event. */ Tcl_DString *dsPtr) /* Initialized, empty string to hold result. */ { | | > > > > > > > > > > > > > > > > > > > > > > > > > > | 106 107 108 109 110 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 | const char * TkpGetString( TkWindow *winPtr, /* Window where event occurred */ XEvent *eventPtr, /* X keyboard event. */ Tcl_DString *dsPtr) /* Initialized, empty string to hold result. */ { int len, mincode, maxcode; Tcl_DString buf; TkKeyEvent *kePtr = (TkKeyEvent *) eventPtr; /* * If we have the value cached already, use it now. [Bug 1373712] */ if (kePtr->charValuePtr != NULL) { Tcl_DStringSetLength(dsPtr, kePtr->charValueLen); memcpy(Tcl_DStringValue(dsPtr), kePtr->charValuePtr, (unsigned) kePtr->charValueLen+1); return Tcl_DStringValue(dsPtr); } /* * Only do this for KeyPress events, otherwise * further Xlib function behavior might be undefined. */ if (eventPtr->type != KeyPress) { len = 0; Tcl_DStringSetLength(dsPtr, len); goto done; } /* * Filter keycodes out of range, otherwise * further Xlib function behavior might be undefined. */ mincode = 0; maxcode = -1; XDisplayKeycodes(winPtr->dispPtr->display, &mincode, &maxcode); if ((eventPtr->xkey.keycode < mincode) || (eventPtr->xkey.keycode > maxcode)) { len = 0; Tcl_DStringSetLength(dsPtr, len); goto done; } #ifdef TK_USE_INPUT_METHODS if ((winPtr->dispPtr->flags & TK_DISPLAY_USE_IM) && (winPtr->inputContext != NULL) && (eventPtr->type == KeyPress)) { Status status; |
︙ | ︙ | |||
213 214 215 216 217 218 219 220 221 222 223 224 225 226 | /* * Cache the string in the event so that if/when we return to this * function, we will be able to produce it without asking X. This stops us * from having to reenter the XIM engine. [Bug 1373712] */ kePtr->charValuePtr = ckalloc(len + 1); kePtr->charValueLen = len; memcpy(kePtr->charValuePtr, Tcl_DStringValue(dsPtr), (unsigned) len + 1); return Tcl_DStringValue(dsPtr); } /* | > | 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | /* * Cache the string in the event so that if/when we return to this * function, we will be able to produce it without asking X. This stops us * from having to reenter the XIM engine. [Bug 1373712] */ done: kePtr->charValuePtr = ckalloc(len + 1); kePtr->charValueLen = len; memcpy(kePtr->charValuePtr, Tcl_DStringValue(dsPtr), (unsigned) len + 1); return Tcl_DStringValue(dsPtr); } /* |
︙ | ︙ |
Changes to unix/tkUnixRFont.c.
︙ | ︙ | |||
854 855 856 857 858 859 860 861 862 863 864 865 866 867 | XGCValues values; XftColor *xftcolor; int clen, nspec, xStart = x; XftGlyphFontSpec specs[NUM_SPEC]; XGlyphInfo metrics; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (fontPtr->ftDraw == 0) { #if DEBUG_FONTSEL printf("Switch to drawable 0x%x\n", drawable); #endif /* DEBUG_FONTSEL */ fontPtr->ftDraw = XftDrawCreate(display, drawable, DefaultVisual(display, fontPtr->screen), | > > > > | 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 | XGCValues values; XftColor *xftcolor; int clen, nspec, xStart = x; XftGlyphFontSpec specs[NUM_SPEC]; XGlyphInfo metrics; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (maxCoord <= y) { return; /* nothing to draw */ } if (fontPtr->ftDraw == 0) { #if DEBUG_FONTSEL printf("Switch to drawable 0x%x\n", drawable); #endif /* DEBUG_FONTSEL */ fontPtr->ftDraw = XftDrawCreate(display, drawable, DefaultVisual(display, fontPtr->screen), |
︙ | ︙ | |||
875 876 877 878 879 880 881 | } XGetGCValues(display, gc, GCForeground, &values); xftcolor = LookUpColor(display, fontPtr, values.foreground); if (tsdPtr->clipRegion != None) { XftDrawSetClip(fontPtr->ftDraw, tsdPtr->clipRegion); } nspec = 0; | | > > | < < | | > > > > | > | | | | > | 879 880 881 882 883 884 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 | } XGetGCValues(display, gc, GCForeground, &values); xftcolor = LookUpColor(display, fontPtr, values.foreground); if (tsdPtr->clipRegion != None) { XftDrawSetClip(fontPtr->ftDraw, tsdPtr->clipRegion); } nspec = 0; while (numBytes > 0) { XftFont *ftFont; FcChar32 c; clen = FcUtf8ToUcs4((FcChar8 *) source, &c, numBytes); if (clen <= 0) { /* * This should not happen, but it can. */ goto doUnderlineStrikeout; } source += clen; numBytes -= clen; ftFont = GetFont(fontPtr, c, 0.0); if (ftFont) { int cx = x; int cy = y; specs[nspec].glyph = XftCharIndex(fontPtr->display, ftFont, c); XftGlyphExtents(fontPtr->display, ftFont, &specs[nspec].glyph, 1, &metrics); if ((x += metrics.xOff) >= maxCoord || (y += metrics.yOff) >= maxCoord) { break; } if (metrics.xOff > 0 && cx >= 0 && cy >= 0) { specs[nspec].font = ftFont; specs[nspec].x = cx; specs[nspec].y = cy; if (++nspec == NUM_SPEC) { XftDrawGlyphFontSpec(fontPtr->ftDraw, xftcolor, specs, nspec); nspec = 0; } } } } if (nspec) { XftDrawGlyphFontSpec(fontPtr->ftDraw, xftcolor, specs, nspec); } |
︙ | ︙ | |||
1007 1008 1009 1010 1011 1012 1013 | XftDrawSetClip(fontPtr->ftDraw, tsdPtr->clipRegion); } nglyph = 0; currentFtFont = NULL; originX = originY = 0; /* lint */ | | < | 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 | XftDrawSetClip(fontPtr->ftDraw, tsdPtr->clipRegion); } nglyph = 0; currentFtFont = NULL; originX = originY = 0; /* lint */ while (numBytes > 0 && x >= minCoord && y >= minCoord) { XftFont *ftFont; FcChar32 c; clen = FcUtf8ToUcs4((FcChar8 *) source, &c, numBytes); if (clen <= 0) { /* * This should not happen, but it can. |
︙ | ︙ | |||
1046 1047 1048 1049 1050 1051 1052 | } originX = ROUND16(x); originY = ROUND16(y); if (nglyph) { XftGlyphExtents(fontPtr->display, currentFtFont, glyphs, nglyph, &metrics); nglyph = 0; | > > > > > > > > | < > > | 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 | } originX = ROUND16(x); originY = ROUND16(y); if (nglyph) { XftGlyphExtents(fontPtr->display, currentFtFont, glyphs, nglyph, &metrics); nglyph = 0; /* * Breaking at this place is sub-optimal, but the whole algorithm * has a design problem, the choice of NUM_SPEC is arbitrary, and so * the inter-glyph spacing will look arbitrary. This algorithm * has to draw the whole string at once (or whole blocks with same * font), this requires a dynamic 'glyphs' array. In case of overflow * the array has to be divided until the maximal string will fit. (GC) */ if ((x += metrics.xOff) >= maxCoord || (y += metrics.yOff) >= maxCoord) { break; } } currentFtFont = ftFont; } glyphs[nglyph++] = XftCharIndex(fontPtr->display, ftFont, c); } if (nglyph) { XftDrawGlyphs(fontPtr->ftDraw, xftcolor, currentFtFont, |
︙ | ︙ | |||
1083 1084 1085 1086 1087 1088 1089 | } XGetGCValues(display, gc, GCForeground, &values); xftcolor = LookUpColor(display, fontPtr, values.foreground); if (tsdPtr->clipRegion != None) { XftDrawSetClip(fontPtr->ftDraw, tsdPtr->clipRegion); } nspec = 0; | < | | 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 | } XGetGCValues(display, gc, GCForeground, &values); xftcolor = LookUpColor(display, fontPtr, values.foreground); if (tsdPtr->clipRegion != None) { XftDrawSetClip(fontPtr->ftDraw, tsdPtr->clipRegion); } nspec = 0; while (numBytes > 0 && x >= minCoord && y >= minCoord) { XftFont *ftFont, *ft0Font; FcChar32 c; clen = FcUtf8ToUcs4((FcChar8 *) source, &c, numBytes); if (clen <= 0) { /* * This should not happen, but it can. |
︙ | ︙ | |||
1108 1109 1110 1111 1112 1113 1114 | if (ftFont && ft0Font) { specs[nspec].font = ftFont; specs[nspec].glyph = XftCharIndex(fontPtr->display, ftFont, c); specs[nspec].x = ROUND16(x); specs[nspec].y = ROUND16(y); XftGlyphExtents(fontPtr->display, ft0Font, &specs[nspec].glyph, 1, &metrics); | | | | > | | 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 | if (ftFont && ft0Font) { specs[nspec].font = ftFont; specs[nspec].glyph = XftCharIndex(fontPtr->display, ftFont, c); specs[nspec].x = ROUND16(x); specs[nspec].y = ROUND16(y); XftGlyphExtents(fontPtr->display, ft0Font, &specs[nspec].glyph, 1, &metrics); if ((x += metrics.xOff*cosA + metrics.yOff*sinA) > maxCoord || (y += metrics.yOff*cosA - metrics.xOff*sinA) > maxCoord) { break; } if (++nspec == NUM_SPEC) { XftDrawGlyphFontSpec(fontPtr->ftDraw, xftcolor, specs, nspec); nspec = 0; } } } if (nspec) { |
︙ | ︙ |
Changes to unix/tkUnixScale.c.
︙ | ︙ | |||
9 10 11 12 13 14 15 16 17 18 19 20 21 22 | * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkScale.h" /* * Forward declarations for functions defined later in this file: */ static void DisplayHorizontalScale(TkScale *scalePtr, Drawable drawable, XRectangle *drawnAreaPtr); static void DisplayHorizontalValue(TkScale *scalePtr, | > > > > | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkScale.h" #if defined(_WIN32) #define snprintf _snprintf #endif /* * Forward declarations for functions defined later in this file: */ static void DisplayHorizontalScale(TkScale *scalePtr, Drawable drawable, XRectangle *drawnAreaPtr); static void DisplayHorizontalValue(TkScale *scalePtr, |
︙ | ︙ | |||
263 264 265 266 267 268 269 | register Tk_Window tkwin = scalePtr->tkwin; int y, width, length; char valueString[TCL_DOUBLE_SPACE]; Tk_FontMetrics fm; Tk_GetFontMetrics(scalePtr->tkfont, &fm); y = TkScaleValueToPixel(scalePtr, value) + fm.ascent/2; | | > > | 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | register Tk_Window tkwin = scalePtr->tkwin; int y, width, length; char valueString[TCL_DOUBLE_SPACE]; Tk_FontMetrics fm; Tk_GetFontMetrics(scalePtr->tkfont, &fm); y = TkScaleValueToPixel(scalePtr, value) + fm.ascent/2; if (snprintf(valueString, TCL_DOUBLE_SPACE, scalePtr->format, value) < 0) { valueString[TCL_DOUBLE_SPACE - 1] = '\0'; } length = (int) strlen(valueString); width = Tk_TextWidth(scalePtr->tkfont, valueString, length); /* * Adjust the y-coordinate if necessary to keep the text entirely inside * the window. */ |
︙ | ︙ | |||
348 349 350 351 352 353 354 | * Ensure that we will only draw enough of the tick values such * that they don't overlap. We base this off the width that * fromValue would take. Not exact, but better than no constraint. */ ticks = fabs((scalePtr->toValue - scalePtr->fromValue) / tickInterval); | > | > > | 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 | * Ensure that we will only draw enough of the tick values such * that they don't overlap. We base this off the width that * fromValue would take. Not exact, but better than no constraint. */ ticks = fabs((scalePtr->toValue - scalePtr->fromValue) / tickInterval); if (snprintf(valueString, TCL_DOUBLE_SPACE, scalePtr->format, scalePtr->fromValue) < 0) { valueString[TCL_DOUBLE_SPACE - 1] = '\0'; } maxTicks = (double) Tk_Width(tkwin) / (double) Tk_TextWidth(scalePtr->tkfont, valueString, -1); if (ticks > maxTicks) { tickInterval *= (ticks / maxTicks); } for (tickValue = scalePtr->fromValue; ; tickValue += tickInterval) { |
︙ | ︙ | |||
480 481 482 483 484 485 486 | int x, y, length, width; char valueString[TCL_DOUBLE_SPACE]; Tk_FontMetrics fm; x = TkScaleValueToPixel(scalePtr, value); Tk_GetFontMetrics(scalePtr->tkfont, &fm); y = top + fm.ascent; | | > > | 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 | int x, y, length, width; char valueString[TCL_DOUBLE_SPACE]; Tk_FontMetrics fm; x = TkScaleValueToPixel(scalePtr, value); Tk_GetFontMetrics(scalePtr->tkfont, &fm); y = top + fm.ascent; if (snprintf(valueString, TCL_DOUBLE_SPACE, scalePtr->format, value) < 0) { valueString[TCL_DOUBLE_SPACE - 1] = '\0'; } length = (int) strlen(valueString); width = Tk_TextWidth(scalePtr->tkfont, valueString, length); /* * Adjust the x-coordinate if necessary to keep the text entirely inside * the window. */ |
︙ | ︙ | |||
547 548 549 550 551 552 553 | /* * Invoke the scale's command if needed. */ Tcl_Preserve(scalePtr); if ((scalePtr->flags & INVOKE_COMMAND) && (scalePtr->command != NULL)) { Tcl_Preserve(interp); | > | > > | 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 | /* * Invoke the scale's command if needed. */ Tcl_Preserve(scalePtr); if ((scalePtr->flags & INVOKE_COMMAND) && (scalePtr->command != NULL)) { Tcl_Preserve(interp); if (snprintf(string, TCL_DOUBLE_SPACE, scalePtr->format, scalePtr->value) < 0) { string[TCL_DOUBLE_SPACE - 1] = '\0'; } Tcl_DStringInit(&buf); Tcl_DStringAppend(&buf, scalePtr->command, -1); Tcl_DStringAppend(&buf, " ", -1); Tcl_DStringAppend(&buf, string, -1); result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, 0); Tcl_DStringFree(&buf); if (result != TCL_OK) { |
︙ | ︙ |
Changes to win/Makefile.in.
︙ | ︙ | |||
203 204 205 206 207 208 209 | COPY = cp BUILD_TCLSH = @BUILD_TCLSH@ # Tk does not used deprecated Tcl constructs so it should # compile fine with -DTCL_NO_DEPRECATED. To remove its own # set of deprecated code uncomment the second line. | | | | 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | COPY = cp BUILD_TCLSH = @BUILD_TCLSH@ # Tk does not used deprecated Tcl constructs so it should # compile fine with -DTCL_NO_DEPRECATED. To remove its own # set of deprecated code uncomment the second line. NO_DEPRECATED_FLAGS = #NO_DEPRECATED_FLAGS = -DTK_NO_DEPRECATED # TCL_EXE is the name of a tclsh executable that is available *BEFORE* # running make for the first time. Certain build targets (make genstubs) # need it to be available on the PATH. This executable should *NOT* be # required just to do a normal build although it can be required to run # make dist. TCL_EXE = @TCLSH_PROG@ |
︙ | ︙ |
Changes to win/configure.
︙ | ︙ | |||
1308 1309 1310 1311 1312 1313 1314 | # versions of autoconf incorrectly set SHELL to /bin/bash instead of # /bin/sh. The bash shell seems to suffer from some strange failures. SHELL=/bin/sh TK_VERSION=8.6 TK_MAJOR_VERSION=8 TK_MINOR_VERSION=6 | | | 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 | # versions of autoconf incorrectly set SHELL to /bin/bash instead of # /bin/sh. The bash shell seems to suffer from some strange failures. SHELL=/bin/sh TK_VERSION=8.6 TK_MAJOR_VERSION=8 TK_MINOR_VERSION=6 TK_PATCH_LEVEL=".8" VER=$TK_MAJOR_VERSION$TK_MINOR_VERSION #------------------------------------------------------------------------ # Handle the --prefix=... option #------------------------------------------------------------------------ if test "${prefix}" = "NONE"; then |
︙ | ︙ |
Changes to win/configure.in.
︙ | ︙ | |||
10 11 12 13 14 15 16 | # versions of autoconf incorrectly set SHELL to /bin/bash instead of # /bin/sh. The bash shell seems to suffer from some strange failures. SHELL=/bin/sh TK_VERSION=8.6 TK_MAJOR_VERSION=8 TK_MINOR_VERSION=6 | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # versions of autoconf incorrectly set SHELL to /bin/bash instead of # /bin/sh. The bash shell seems to suffer from some strange failures. SHELL=/bin/sh TK_VERSION=8.6 TK_MAJOR_VERSION=8 TK_MINOR_VERSION=6 TK_PATCH_LEVEL=".8" VER=$TK_MAJOR_VERSION$TK_MINOR_VERSION #------------------------------------------------------------------------ # Handle the --prefix=... option #------------------------------------------------------------------------ if test "${prefix}" = "NONE"; then |
︙ | ︙ |
Changes to win/makefile.vc.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #------------------------------------------------------------- -*- makefile -*- # makefile.vc -- # # Microsoft Visual C++ makefile for use with nmake.exe v1.62+ (VC++ 5.0+) # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # Copyright (c) 1995-1996 Sun Microsystems, Inc. # Copyright (c) 1998-2000 Ajuba Solutions. # Copyright (c) 2001-2005 ActiveState Corporation. # Copyright (c) 2001-2004 David Gravereaux. # Copyright (c) 2003-2008 Pat Thoyts. #------------------------------------------------------------------------------ | > < < < < < < < < | | < < < < < < > > > | < < < < | < | < < < > < < > > > | < | < < < < < < < < < < > > | > < < < < < < < < < < < | | | | | | | | | | > | < | < < < < < < < < < < < < < < < < < < | < < < < < | < < < > | < < > | < > | < < < < < < < < < | < < < < < < < < | < < < | | < < < < < | < < < | < < < < < < < < | > > | < < < < < < < < < < < < < < < < | < < < < < < | 1 2 3 4 5 6 7 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 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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | #------------------------------------------------------------- -*- makefile -*- # makefile.vc -- # # Microsoft Visual C++ makefile for use with nmake.exe v1.62+ (VC++ 5.0+) # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # Copyright (c) 1995-1996 Sun Microsystems, Inc. # Copyright (c) 1998-2000 Ajuba Solutions. # Copyright (c) 2001-2005 ActiveState Corporation. # Copyright (c) 2001-2004 David Gravereaux. # Copyright (c) 2003-2008 Pat Thoyts. # Copyright (c) 2017 Ashok P. Nadkarni #------------------------------------------------------------------------------ # General usage: # nmake [-nologo] -f makefile.vc [TARGET|MACRODEF [TARGET|MACRODEF] [...]] # # For MACRODEF, see TIP 477 (https://core.tcl.tk/tips/doc/trunk/tip/477.md) # or examine Sections 6-8 in rules.vc. This makefile has the following # values for the OPTS macro in addition to the ones described there. # noxp = If you do not have the uxtheme.h header then you # cannot include support for XP themeing. # square = Include the demo square widget. # # Possible values for TARGET are: # release -- Builds the core, the shell and the dlls. (default) # dlls -- Just builds the windows extensions. # shell -- Just builds the shell and the core. # core -- Only builds the core [tkXX.(dll|lib)]. # all -- Builds everything. # test -- Builds and runs the test suite. # tktest -- Just builds the binaries for the test suite. # install -- Installs the built binaries and libraries to $(INSTALLDIR) # as the root of the install tree. # cwish -- Builds a console version of wish. # tidy/clean/hose -- varying levels of cleaning. # genstubs -- Rebuilds the Stubs table and support files (dev only). # depend -- Generates an accurate set of source dependancies for this # makefile. Helpful to avoid problems when the sources are # refreshed and you rebuild, but can "overbuild" when common # headers like tkInt.h just get small changes. # htmlhelp -- Builds a Windows .chm help file for Tcl and Tk from the # troff manual pages found in $(ROOT)\doc. You need to # have installed the HTML Help Compiler package from Microsoft # to produce the .chm file. # # The steps to setup a Visual C++ environment depend on which # version of Visual Studio and/or the Windows SDK you are building # against and are not described here. The simplest method is generally # to start a command shell using one of the short cuts installed by # Visual Studio/Windows SDK for the appropriate target architecture. # # NOTE: For older (Visual C++ 6 or the 2003 SDK), to use the Platform # SDK (not expressly needed), run setenv.bat after vcvars32.bat # according to the instructions for it. This can also turn on the # 64-bit compiler, if your SDK has it. # # Examples: # Assumign Tcl sources lie in ../../tcl # c:\tcl_src\win\>nmake -f makefile.vc release # If Tcl sources are not in ../../tcl, use the TCLDIR macro to specify dir # c:\tcl_src\win\>nmake -f makefile.vc release TCLDIR=c:\src\tcl # Run the test suite # c:\tcl_src\win\>nmake -f makefile.vc test # Install Tk in location specified by INSTALLDIR macro # c:\tcl_src\win\>nmake -f makefile.vc install INSTALLDIR=c:\progra~1\tcl # Build release with PDF files # c:\tcl_src\win\>nmake -f makefile.vc release OPTS=pdbs # Build debug version # c:\tcl_src\win\>nmake -f makefile.vc release OPTS=symbols # ############################################################################### # The PROJECT macro is used by rules.vc for generating appropriate # macros and rules. PROJECT = tk # Default target to build if no target is specified. If unspecified, the # rules.vc file will set up "all" as the target. DEFAULT_BUILD_TARGET = release # We have a custom resource file RCFILE = tk.rc # The rules.vc file does much of the hard work in terms of defining # the build configuration, macros, output directories etc. !include "rules-ext.vc" # TCLINSTALL is set to 1 by rules.vc to indicate we are building against # an installed Tcl and 0 if building against Tcl source. Tk needs the latter. !if $(TCLINSTALL) !message *** Warning: Tk requires the source distribution of Tcl to build from, !message *** at this time, sorry. Please set the TCLDIR macro to point to the !message *** Tcl sources. !endif # Extra makefile options processing for non-standard OPTS values ... !if "$(OPTS)" == "" || [nmakehlp -f "$(OPTS)" "none"] HAVE_UXTHEME_H = 1 TTK_SQUARE_WIDGET = 0 !else !if [nmakehlp -f $(OPTS) "noxp"] !message *** Exclude support for XP theme HAVE_UXTHEME_H = 0 !else HAVE_UXTHEME_H = 1 !endif !if [nmakehlp -f "$(OPTS)" "square"] !message *** Include ttk square demo widget TTK_SQUARE_WIDGET = 1 !else TTK_SQUARE_WIDGET = 0 !endif !endif WISHC = "$(OUT_DIR)\$(WISHNAMEPREFIX)c$(VERSION)$(SUFX).exe" TKTEST = "$(OUT_DIR)\$(PROJECT)test.exe" CAT32 = "$(OUT_DIR)\cat32.exe" WISHOBJS = \ $(TMP_DIR)\winMain.obj \ !if $(TCL_USE_STATIC_PACKAGES) $(TCLDDELIB) \ $(TCLREGLIB) \ !endif $(TMP_DIR)\wish.res |
︙ | ︙ | |||
405 406 407 408 409 410 411 | $(TMP_DIR)\ttkWidget.obj \ $(TMP_DIR)\ttkStubInit.obj TKSTUBOBJS = \ $(TMP_DIR)\tkStubLib.obj \ $(TMP_DIR)\ttkStubLib.obj | | | < < < > > | < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < | < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < > | | | | | | < < < < | < < < | > | > | | | > > | | | | | | | > | | | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | > | < < < < < < < < < < < < < < < < < < < < < < > | | | | | | | | | | 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 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 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 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 521 522 523 524 525 526 527 528 529 530 531 532 533 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 566 | $(TMP_DIR)\ttkWidget.obj \ $(TMP_DIR)\ttkStubInit.obj TKSTUBOBJS = \ $(TMP_DIR)\tkStubLib.obj \ $(TMP_DIR)\ttkStubLib.obj ### The following paths CANNOT have spaces in them as they appear on ### the left side of implicit rules. XLIBDIR = $(ROOT)\xlib TTKDIR = $(ROOT)\generic\ttk BITMAPDIR = $(ROOT)\bitmaps # Additional include and C macro definitions for the implicit rules # defined in rules.vc PRJ_INCLUDES = -I"$(BITMAPDIR)" -I"$(XLIBDIR)" CONFIG_DEFS =-DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 \ -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 \ -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 \ -DSUPPORT_CONFIG_EMBEDDED \ !if $(HAVE_UXTHEME_H) -DHAVE_UXTHEME_H=1 \ !endif !if $(TTK_SQUARE_WIDGET) -DTTK_SQUARE_WIDGET=1 \ !endif PRJ_DEFINES = -DBUILD_ttk $(CONFIG_DEFS) -Dinline=__inline -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE # Additional Link libraries needed beyond those in rules.vc PRJ_LIBS = netapi32.lib gdi32.lib user32.lib userenv.lib #--------------------------------------------------------------------- # TkTest flags #--------------------------------------------------------------------- !if "$(TESTPAT)" != "" TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT) !endif #--------------------------------------------------------------------- # Project specific targets #--------------------------------------------------------------------- release: setup $(TKSTUBLIB) $(WISH) all: release $(CAT32) core: setup $(TKSTUBLIB) $(TKLIB) cwish: $(WISHC) install: install-binaries install-libraries install-docs tktest: setup $(TKTEST) $(CAT32) setup: default-setup test: test-classic test-ttk test-classic: setup $(TKTEST) $(TKLIB) $(CAT32) @set TCL_LIBRARY=$(TCL_LIBRARY:\=/) @set TK_LIBRARY=$(LIBDIR:\=/) @set TCLLIBPATH= !if $(TCLINSTALL) @set PATH=$(_TCLDIR)\bin;$(PATH) !else @set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH) !endif $(DEBUGGER) $(TKTEST) "$(ROOT:\=/)/tests/all.tcl" $(TESTFLAGS) | $(CAT32) test-ttk: setup $(TKTEST) $(TKLIB) $(CAT32) @set TCL_LIBRARY=$(TCL_LIBRARY:\=/) @set TK_LIBRARY=$(LIBDIR:\=/) @set TCLLIBPATH= !if $(TCLINSTALL) @set PATH=$(_TCLDIR)\bin;$(PATH) !else @set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH) !endif $(DEBUGGER) $(TKTEST) "$(ROOT:\=/)/tests/ttk/all.tcl" $(TESTFLAGS) | $(CAT32) runtest: setup $(TKTEST) $(TKLIB) $(CAT32) @set TCL_LIBRARY=$(TCL_LIBRARY:\=/) @set TK_LIBRARY=$(LIBDIR:\=/) @set TCLLIBPATH= !if $(TCLINSTALL) @set PATH=$(_TCLDIR)\bin;$(PATH) !else @set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH) !endif $(DEBUGGER) $(TKTEST) rundemo: setup $(TKTEST) $(TKLIB) $(CAT32) @set TCL_LIBRARY=$(TCL_LIBRARY:\=/) @set TK_LIBRARY=$(LIBDIR:\=/) @set TCLLIBPATH= !if $(TCLINSTALL) @set PATH=$(_TCLDIR)\bin;$(PATH) !else @set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH) !endif $(TKTEST) $(ROOT:\=/)\library\demos\widget shell: setup $(WISH) @set TCL_LIBRARY=$(TCL_LIBRARY:\=/) @set TK_LIBRARY=$(LIBDIR:\=/) @set TCLLIBPATH= !if $(TCLINSTALL) @set PATH=$(_TCLDIR)\bin;$(PATH) !else @set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH) !endif $(DEBUGGER) $(WISH) << console show << dbgshell: setup $(WISH) @set TCL_LIBRARY=$(TCL_LIBRARY:\=/) @set TK_LIBRARY=$(LIBDIR:\=/) @set TCLLIBPATH= !if $(TCLINSTALL) @set PATH=$(_TCLDIR)\bin;$(PATH) !else @set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH) !endif windbg $(WISH) !if $(STATIC_BUILD) $(TKLIB): $(TKOBJS) $(LIBCMD) @<< $** << !else $(TKLIB): $(TKOBJS) $(DLLCMD) @<< $** << $(_VC_MANIFEST_EMBED_DLL) @if exist $*.exp del $*.exp $(TKIMPLIB): $(TKLIB) !endif # $(STATIC_BUILD) $(TKSTUBLIB): $(TKSTUBOBJS) $(LIBCMD) -nodefaultlib $** $(WISH): $(WISHOBJS) $(TKSTUBLIB) $(TKIMPLIB) $(GUIEXECMD) -stack:2300000 $** $(_VC_MANIFEST_EMBED_EXE) $(WISHC): $(WISHOBJS) $(TKSTUBLIB) $(TKIMPLIB) $(CONEXECMD) -stack:2300000 $** $(_VC_MANIFEST_EMBED_EXE) $(TKTEST): $(TKTESTOBJS) $(TKSTUBLIB) $(TKIMPLIB) $(GUIEXECMD) -stack:2300000 $** $(_VC_MANIFEST_EMBED_EXE) $(CAT32): $(_TCLDIR)\win\cat.c $(cc32) $(cflags) $(crt) -D_CRT_NONSTDC_NO_DEPRECATE -DCONSOLE -Fo$(TMP_DIR)\ $? $(CONEXECMD) -DCONSOLE -stack:16384 $(TMP_DIR)\cat.obj $(_VC_MANIFEST_EMBED_EXE) #--------------------------------------------------------------------- # Regenerate the stubs files. [Development use only] #--------------------------------------------------------------------- genstubs: !if !exist($(TCLSH)) @echo Build tclsh first! !else set TCL_LIBRARY=$(TCL_LIBRARY) $(TCLSH) $(_TCLDIR)\tools\genStubs.tcl $(GENERICDIR) \ $(GENERICDIR)\$(PROJECT).decls $(GENERICDIR)\$(PROJECT)Int.decls !endif #--------------------------------------------------------------------- # Build the Windows HTML help file. #--------------------------------------------------------------------- !if defined(PROCESSOR_ARCHITECTURE) && "$(PROCESSOR_ARCHITECTURE)" == "AMD64" HHC="%ProgramFiles(x86)%\HTML Help Workshop\hhc.exe" !else HHC="%ProgramFiles%\HTML Help Workshop\hhc.exe" !endif HTMLDIR=$(ROOT)\html HTMLBASE=TclTk$(TCL_VERSION) HHPFILE=$(HTMLDIR)\$(HTMLBASE).hhp CHMFILE=$(HTMLDIR)\$(HTMLBASE).chm htmlhelp: chmsetup $(CHMFILE) $(CHMFILE): $(DOCDIR)\* @$(TCLSH) $(TCLTOOLSDIR)\tcltk-man2html.tcl @echo Compiling HTML help project @"$(HHC)" <<$(HHPFILE) >NUL [OPTIONS] Compatibility=1.1 or later Compiled file=$(HTMLBASE).chm Display compile progress=no Error log file=$(HTMLBASE).log Language=0x409 English (United States) Title=Tcl/Tk $(TCL_DOTVERSION) Help [FILES] contents.htm docs.css Keywords TclCmd TclLib TkCmd TkLib UserCmd << chmsetup: @if not exist $(HTMLDIR)\nul mkdir $(HTMLDIR) install-docs: !if exist("$(CHMFILE)") @echo Installing compiled HTML help @$(CPY) "$(CHMFILE)" "$(DOC_INSTALL_DIR)\" !endif # "emacs font-lock highlighting fix #--------------------------------------------------------------------- # Special case object file targets #--------------------------------------------------------------------- $(TMP_DIR)\testMain.obj: $(WINDIR)\winMain.c $(cc32) $(appcflags_nostubs) -DTK_TEST \ -DTCL_USE_STATIC_PACKAGES=$(TCL_USE_STATIC_PACKAGES) \ -Fo$@ $? $(TMP_DIR)\tkTest.obj: $(GENERICDIR)\tkTest.c $(cc32) $(appcflags_nostubs) -Fo$@ $? $(TMP_DIR)\tkOldTest.obj: $(GENERICDIR)\tkOldTest.c $(cc32) $(appcflags_nostubs) -Fo$@ $? $(TMP_DIR)\tkWinTest.obj: $(WINDIR)\tkWinTest.c $(cc32) $(appcflags_nostubs) -Fo$@ $? $(TMP_DIR)\tkSquare.obj: $(GENERICDIR)\tkSquare.c $(cc32) $(appcflags_nostubs) -Fo$@ $? $(TMP_DIR)\winMain.obj: $(WINDIR)\winMain.c $(cc32) $(appcflags_nostubs) \ -DTCL_USE_STATIC_PACKAGES=$(TCL_USE_STATIC_PACKAGES) \ -Fo$@ $? $(TMP_DIR)\tkMain2.obj: $(GENERICDIR)\tkMain.c $(cc32) $(pkgcflags) -DTK_ASCII_MAIN -Fo$@ $? # The following objects are part of the stub library and should not # be built as DLL objects but none of the symbols should be exported # and no reference made to a C runtime. $(TMP_DIR)\tkStubLib.obj : $(GENERICDIR)\tkStubLib.c $(cc32) $(stubscflags) -Fo$@ $? $(TMP_DIR)\wish.exe.manifest: $(WINDIR)\wish.exe.manifest.in @nmakehlp -s << $** >$@ @MACHINE@ $(MACHINE:IX86=X86) @TK_WIN_VERSION@ $(DOTVERSION).0.0 << #--------------------------------------------------------------------- # Generate the source dependencies. Having dependency rules will # improve incremental build accuracy without having to resort to a # full rebuild just because some non-global header file like # tclCompile.h was changed. These rules aren't needed when building |
︙ | ︙ | |||
904 905 906 907 908 909 910 | !message #--------------------------------------------------------------------- # Implicit rules #--------------------------------------------------------------------- {$(XLIBDIR)}.c{$(TMP_DIR)}.obj:: | < < < | < < < < < | < < | < < < < < < < | | | | | < | | | | | > > > > | < < < < < < < < < < < < < < < < < < < < < | 600 601 602 603 604 605 606 607 608 609 610 611 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 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 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 | !message #--------------------------------------------------------------------- # Implicit rules #--------------------------------------------------------------------- {$(XLIBDIR)}.c{$(TMP_DIR)}.obj:: $(CCPKGCMD) @<< $< << {$(TTKDIR)}.c{$(TMP_DIR)}.obj:: $(CCPKGCMD) @<< $< << {$(ROOT)\unix}.c{$(TMP_DIR)}.obj:: $(CCPKGCMD) @<< $< << $(TMP_DIR)\tk.res: $(TMP_DIR)\wish.exe.manifest $(TMP_DIR)\wish.res: $(TMP_DIR)\wish.exe.manifest .SUFFIXES: .SUFFIXES:.c .rc #--------------------------------------------------------------------- # Installation. #--------------------------------------------------------------------- install-binaries: @echo installing binaries @$(CPY) "$(WISH)" "$(BIN_INSTALL_DIR)\" !if "$(TKLIB)" != "$(TKIMPLIB)" @$(CPY) "$(TKLIB)" "$(BIN_INSTALL_DIR)\" !endif @$(CPY) "$(TKIMPLIB)" "$(LIB_INSTALL_DIR)\" @$(CPY) "$(TKSTUBLIB)" "$(LIB_INSTALL_DIR)\" !if !$(STATIC_BUILD) @echo creating package index @type << > $(OUT_DIR)\pkgIndex.tcl if {[catch {package present Tcl 8.6.0}]} { return } if {($$::tcl_platform(platform) eq "unix") && ([info exists ::env(DISPLAY)] || ([info exists ::argv] && ("-display" in $$::argv)))} { package ifneeded Tk $(TK_PATCH_LEVEL) [list load [file join $$dir .. .. bin libtk$(DOTVERSION).dll] Tk] } else { package ifneeded Tk $(TK_PATCH_LEVEL) [list load [file join $$dir .. .. bin $(TKLIBNAME)] Tk] } << @$(CPY) $(OUT_DIR)\pkgIndex.tcl "$(SCRIPT_INSTALL_DIR)\" !endif #" install-libraries: @echo installing Tk headers @$(CPY) "$(GENERICDIR)\tk.h" "$(INCLUDE_INSTALL_DIR)\" @$(CPY) "$(GENERICDIR)\tkDecls.h" "$(INCLUDE_INSTALL_DIR)\" @$(CPY) "$(GENERICDIR)\tkPlatDecls.h" "$(INCLUDE_INSTALL_DIR)\" @$(CPY) "$(GENERICDIR)\tkIntXlibDecls.h" "$(INCLUDE_INSTALL_DIR)\" @$(CPY) "$(XLIBDIR)\X11\*.h" "$(INCLUDE_INSTALL_DIR)\X11\" @echo installing script library @$(CPY) "$(LIBDIR)\*" "$(SCRIPT_INSTALL_DIR)\" @echo installing theme library @$(CPY) "$(LIBDIR)\ttk\*" "$(SCRIPT_INSTALL_DIR)\ttk\" @echo installing images @$(CPY) "$(LIBDIR)\images\*" "$(SCRIPT_INSTALL_DIR)\images\" @echo installing language files @$(CPY) "$(LIBDIR)\msgs\*" "$(SCRIPT_INSTALL_DIR)\msgs\" @echo installing demos @$(CPY) "$(DEMODIR)\*" "$(DEMO_INSTALL_DIR)\" @$(CPY) "$(DEMODIR)\images\*" "$(DEMO_INSTALL_DIR)\images\" #" #--------------------------------------------------------------------- # Clean up #--------------------------------------------------------------------- clean: default-clean realclean: hose hose: default-hose tidy: !if "$(TKLIB)" != "$(TKIMPLIB)" @echo Removing $(TKLIB) ... @if exist $(TKLIB) del $(TKLIB) !endif @echo Removing $(TKIMPLIB) ... @if exist $(TKIMPLIB) del $(TKIMPLIB) @echo Removing $(WISH) ... @if exist $(WISH) del $(WISH) @echo Removing $(TKTEST) ... @if exist $(TKTEST) del $(TKTEST) @echo Removing $(TKSTUBLIB) ... @if exist $(TKSTUBLIB) del $(TKSTUBLIB) |
Changes to win/nmakehlp.c.
︙ | ︙ | |||
35 36 37 38 39 40 41 | /* ISO hack for dumb VC++ */ #ifdef _MSC_VER #define snprintf _snprintf #endif | < | > | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | /* ISO hack for dumb VC++ */ #ifdef _MSC_VER #define snprintf _snprintf #endif /* protos */ static int CheckForCompilerFeature(const char *option); static int CheckForLinkerFeature(const char **options, int count); static int IsIn(const char *string, const char *substring); static int SubstituteFile(const char *substs, const char *filename); static int QualifyPath(const char *path); static int LocateDependency(const char *keyfile); static const char *GetVersionFromFile(const char *filename, const char *match, int numdots); static DWORD WINAPI ReadFromPipe(LPVOID args); /* globals */ #define CHUNK 25 #define STATICBUFFERSIZE 1000 |
︙ | ︙ | |||
70 71 72 73 74 75 76 77 78 79 80 81 82 83 | main( int argc, char *argv[]) { char msg[300]; DWORD dwWritten; int chars; /* * Make sure children (cl.exe and link.exe) are kept quiet. */ SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); | > | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | main( int argc, char *argv[]) { char msg[300]; DWORD dwWritten; int chars; char *s; /* * Make sure children (cl.exe and link.exe) are kept quiet. */ SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); |
︙ | ︙ | |||
98 99 100 101 102 103 104 | "exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]); WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL); return 2; } return CheckForCompilerFeature(argv[2]); case 'l': | | | | | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | "exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]); WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL); return 2; } return CheckForCompilerFeature(argv[2]); case 'l': if (argc < 3) { chars = snprintf(msg, sizeof(msg) - 1, "usage: %s -l <linker option> ?<mandatory option> ...?\n" "Tests for whether link.exe supports an option\n" "exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]); WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL); return 2; } return CheckForLinkerFeature(&argv[2], argc-2); case 'f': if (argc == 2) { chars = snprintf(msg, sizeof(msg) - 1, "usage: %s -f <string> <substring>\n" "Find a substring within another\n" "exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]); WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, |
︙ | ︙ | |||
149 150 151 152 153 154 155 | "Extract a version from a file:\n" "eg: pkgIndex.tcl \"package ifneeded http\"", argv[0]); WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL); return 0; } | | > > | > > > > > > > > > > > > > > > | 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 | "Extract a version from a file:\n" "eg: pkgIndex.tcl \"package ifneeded http\"", argv[0]); WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL); return 0; } s = GetVersionFromFile(argv[2], argv[3], *(argv[1]+2) - '0'); if (s && *s) { printf("%s\n", s); return 0; } else return 1; /* Version not found. Return non-0 exit code */ case 'Q': if (argc != 3) { chars = snprintf(msg, sizeof(msg) - 1, "usage: %s -Q path\n" "Emit the fully qualified path\n" "exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]); WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL); return 2; } return QualifyPath(argv[2]); case 'L': if (argc != 3) { chars = snprintf(msg, sizeof(msg) - 1, "usage: %s -L keypath\n" "Emit the fully qualified path of directory containing keypath\n" "exitcodes: 0 == success, 1 == not found, 2 == error\n", argv[0]); WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL); return 2; } return LocateDependency(argv[2]); } } chars = snprintf(msg, sizeof(msg) - 1, "usage: %s -c|-f|-l|-Q|-s|-V ...\n" "This is a little helper app to equalize shell differences between WinNT and\n" "Win9x and get nmake.exe to accomplish its job.\n", argv[0]); |
︙ | ︙ | |||
309 310 311 312 313 314 315 | || strstr(Err.buffer, "D9002") != NULL || strstr(Out.buffer, "D2021") != NULL || strstr(Err.buffer, "D2021") != NULL); } static int CheckForLinkerFeature( | | > > | | 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 | || strstr(Err.buffer, "D9002") != NULL || strstr(Out.buffer, "D2021") != NULL || strstr(Err.buffer, "D2021") != NULL); } static int CheckForLinkerFeature( const char **options, int count) { STARTUPINFO si; PROCESS_INFORMATION pi; SECURITY_ATTRIBUTES sa; DWORD threadID; char msg[300]; BOOL ok; HANDLE hProcess, h, pipeThreads[2]; int i; char cmdline[255]; hProcess = GetCurrentProcess(); ZeroMemory(&pi, sizeof(PROCESS_INFORMATION)); ZeroMemory(&si, sizeof(STARTUPINFO)); si.cb = sizeof(STARTUPINFO); si.dwFlags = STARTF_USESTDHANDLES; |
︙ | ︙ | |||
364 365 366 367 368 369 370 | lstrcpy(cmdline, "link.exe -nologo "); /* * Append our option for testing. */ | > | > > > | 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | lstrcpy(cmdline, "link.exe -nologo "); /* * Append our option for testing. */ for (i = 0; i < count; i++) { lstrcat(cmdline, " \""); lstrcat(cmdline, options[i]); lstrcat(cmdline, "\""); } ok = CreateProcess( NULL, /* Module name. */ cmdline, /* Command line. */ NULL, /* Process handle not inheritable. */ NULL, /* Thread handle not inheritable. */ TRUE, /* yes, inherit handles. */ |
︙ | ︙ | |||
429 430 431 432 433 434 435 | /* * Look for the commandline warning code in the stderr stream. */ return !(strstr(Out.buffer, "LNK1117") != NULL || strstr(Err.buffer, "LNK1117") != NULL || strstr(Out.buffer, "LNK4044") != NULL || | | > > | 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | /* * Look for the commandline warning code in the stderr stream. */ return !(strstr(Out.buffer, "LNK1117") != NULL || strstr(Err.buffer, "LNK1117") != NULL || strstr(Out.buffer, "LNK4044") != NULL || strstr(Err.buffer, "LNK4044") != NULL || strstr(Out.buffer, "LNK4224") != NULL || strstr(Err.buffer, "LNK4224") != NULL); } static DWORD WINAPI ReadFromPipe( LPVOID args) { pipeinfo *pi = (pipeinfo *) args; |
︙ | ︙ | |||
681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 | while ((p = strchr(szPath, '/')) && *p) *p = '\\'; PathCombine(szTmp, szCwd, szPath); PathCanonicalize(szCwd, szTmp); printf("%s\n", szCwd); return 0; } /* * Local variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * indent-tabs-mode: t * tab-width: 8 * End: */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 746 747 748 749 750 751 752 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 | while ((p = strchr(szPath, '/')) && *p) *p = '\\'; PathCombine(szTmp, szCwd, szPath); PathCanonicalize(szCwd, szTmp); printf("%s\n", szCwd); return 0; } /* * Implements LocateDependency for a single directory. See that command * for an explanation. * Returns 0 if found after printing the directory. * Returns 1 if not found but no errors. * Returns 2 on any kind of error * Basically, these are used as exit codes for the process. */ static int LocateDependencyHelper(const char *dir, const char *keypath) { HANDLE hSearch; char path[MAX_PATH+1]; int dirlen, keylen, ret; WIN32_FIND_DATA finfo; if (dir == NULL || keypath == NULL) return 2; /* Have no real error reporting mechanism into nmake */ dirlen = strlen(dir); if ((dirlen + 3) > sizeof(path)) return 2; strncpy(path, dir, dirlen); strncpy(path+dirlen, "\\*", 3); /* Including terminating \0 */ keylen = strlen(keypath); #if 0 /* This function is not available in Visual C++ 6 */ /* * Use numerics 0 -> FindExInfoStandard, * 1 -> FindExSearchLimitToDirectories, * as these are not defined in Visual C++ 6 */ hSearch = FindFirstFileEx(path, 0, &finfo, 1, NULL, 0); #else hSearch = FindFirstFile(path, &finfo); #endif if (hSearch == INVALID_HANDLE_VALUE) return 1; /* Not found */ /* Loop through all subdirs checking if the keypath is under there */ ret = 1; /* Assume not found */ do { int sublen; /* * We need to check it is a directory despite the * FindExSearchLimitToDirectories in the above call. See SDK docs */ if ((finfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) continue; sublen = strlen(finfo.cFileName); if ((dirlen+1+sublen+1+keylen+1) > sizeof(path)) continue; /* Path does not fit, assume not matched */ strncpy(path+dirlen+1, finfo.cFileName, sublen); path[dirlen+1+sublen] = '\\'; strncpy(path+dirlen+1+sublen+1, keypath, keylen+1); if (PathFileExists(path)) { /* Found a match, print to stdout */ path[dirlen+1+sublen] = '\0'; QualifyPath(path); ret = 0; break; } } while (FindNextFile(hSearch, &finfo)); FindClose(hSearch); return ret; } /* * LocateDependency -- * * Locates a dependency for a package. * keypath - a relative path within the package directory * that is used to confirm it is the correct directory. * The search path for the package directory is currently only * the parent and grandparent of the current working directory. * If found, the command prints * name_DIRPATH=<full path of located directory> * and returns 0. If not found, does not print anything and returns 1. */ static int LocateDependency(const char *keypath) { int i, ret; static char *paths[] = {"..", "..\\..", "..\\..\\.."}; for (i = 0; i < (sizeof(paths)/sizeof(paths[0])); ++i) { ret = LocateDependencyHelper(paths[i], keypath); if (ret == 0) return ret; } return ret; } /* * Local variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * indent-tabs-mode: t * tab-width: 8 * End: */ |
Added win/rules-ext.vc.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 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 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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | # This file should only be included in makefiles for Tcl extensions, # NOT in the makefile for Tcl itself. !ifndef _RULES_EXT_VC # We need to run from the directory the parent makefile is located in. # nmake does not tell us what makefile was used to invoke it so parent # makefile has to set the MAKEFILEVC macro or we just make a guess and # warn if we think that is not the case. !if "$(MAKEFILEVC)" == "" !if exist("$(PROJECT).vc") MAKEFILEVC = $(PROJECT).vc !elseif exist("makefile.vc") MAKEFILEVC = makefile.vc !endif !endif # "$(MAKEFILEVC)" == "" !if !exist("$(MAKEFILEVC)") MSG = ^ You must run nmake from the directory containing the project makefile.^ If you are doing that and getting this message, set the MAKEFILEVC^ macro to the name of the project makefile. !message WARNING: $(MSG) !endif !if "$(PROJECT)" == "tcl" !error The rules-ext.vc file is not intended for Tcl itself. !endif # We extract version numbers using the nmakehlp program. For now use # the local copy of nmakehlp. Once we locate Tcl, we will use that # one if it is newer. !if [$(CC) -nologo "nmakehlp.c" -link -subsystem:console > nul] !endif # First locate the Tcl directory that we are working with. !ifdef TCLDIR _RULESDIR = $(TCLDIR:/=\) !else # If an installation path is specified, that is also the Tcl directory. # Also Tk never builds against an installed Tcl, it needs Tcl sources !if defined(INSTALLDIR) && "$(PROJECT)" != "tk" _RULESDIR=$(INSTALLDIR:/=\) !else # Locate Tcl sources !if [echo _RULESDIR = \> nmakehlp.out] \ || [nmakehlp -L generic\tcl.h >> nmakehlp.out] _RULESDIR = ..\..\tcl !else !include nmakehlp.out !endif !endif # defined(INSTALLDIR).... !endif # ifndef TCLDIR # Now look for the targets.vc file under the Tcl root. Note we check this # file and not rules.vc because the latter also exists on older systems. !if exist("$(_RULESDIR)\lib\nmake\targets.vc") # Building against installed Tcl _RULESDIR = $(_RULESDIR)\lib\nmake !elseif exist("$(_RULESDIR)\win\targets.vc") # Building against Tcl sources _RULESDIR = $(_RULESDIR)\win !else # If we have not located Tcl's targets file, most likely we are compiling # against an older version of Tcl and so must use our own support files. _RULESDIR = . !endif !if "$(_RULESDIR)" != "." # Potentially using Tcl's support files. If this extension has its own # nmake support files, need to compare the versions and pick newer. !if exist("rules.vc") # The extension has its own copy !if [echo TCL_RULES_MAJOR = \> versions.vc] \ && [nmakehlp -V "$(_RULESDIR)\rules.vc" RULES_VERSION_MAJOR >> versions.vc] !endif !if [echo TCL_RULES_MINOR = \>> versions.vc] \ && [nmakehlp -V "$(_RULESDIR)\rules.vc" RULES_VERSION_MINOR >> versions.vc] !endif !if [echo OUR_RULES_MAJOR = \>> versions.vc] \ && [nmakehlp -V "rules.vc" RULES_VERSION_MAJOR >> versions.vc] !endif !if [echo OUR_RULES_MINOR = \>> versions.vc] \ && [nmakehlp -V "rules.vc" RULES_VERSION_MINOR >> versions.vc] !endif !include versions.vc # We have a newer version of the support files, use them !if ($(TCL_RULES_MAJOR) != $(OUR_RULES_MAJOR)) || ($(TCL_RULES_MINOR) < $(OUR_RULES_MINOR)) _RULESDIR = . !endif !endif # if exist("rules.vc") !endif # if $(_RULESDIR) != "." # Let rules.vc know what copy of nmakehlp.c to use. NMAKEHLPC = $(_RULESDIR)\nmakehlp.c # Get rid of our internal defines before calling rules.vc !undef TCL_RULES_MAJOR !undef TCL_RULES_MINOR !undef OUR_RULES_MAJOR !undef OUR_RULES_MINOR !if exist("$(_RULESDIR)\rules.vc") !message *** Using $(_RULESDIR)\rules.vc !include "$(_RULESDIR)\rules.vc" !else !error *** Could not locate rules.vc in $(_RULESDIR) !endif !endif # _RULES_EXT_VC |
Changes to win/rules.vc.
|
| | | | > > > > > > > > > > > | > | > > | > > > | > > > > > > > > | > | < > > > > | > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < < < < < < > < < < < < < < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > | > > > > > > > | > > > > > > > > > > > > > > > > > > > > < < < < < | < > | | < > | > > > > > > > > > > > > > | | > > > | > > > > | < < < > > > > > < < < < | | | > > > > > > > > | > > | < < < > > > | < | < > > > > < < | < < < < < | | < < | < < < < < < < < < < < < < < < < < < < | > > > > > > > > | > | | < > | > | > > > > > < < > > > | < > | > > > > > | > | > > > > > > | > > | > > > > > > > > > | | > < > > > > > > > > > > > > > > > > > > > | < > > > > > > < > < > > > > > > > > > > > > | | > > > > | > > > > > > > | < < < > > > < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | < < | < | | < | < | > > > > | > > > > > > > > > > > > | | 1 2 3 4 5 6 7 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 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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 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 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 249 250 251 252 253 254 255 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 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 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 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 521 522 523 524 525 526 527 528 529 530 531 532 533 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 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 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 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 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 746 747 748 749 750 751 752 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 856 857 858 859 860 861 862 863 864 865 866 867 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 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 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 | #------------------------------------------------------------- -*- makefile -*- # rules.vc -- # # Part of the nmake based build system for Tcl and its extensions. # This file does all the hard work in terms of parsing build options, # compiler switches, defining common targets and macros. The Tcl makefile # directly includes this. Extensions include it via "rules-ext.vc". # # See TIP 477 (https://core.tcl.tk/tips/doc/trunk/tip/477.md) for # detailed documentation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # Copyright (c) 2001-2003 David Gravereaux. # Copyright (c) 2003-2008 Patrick Thoyts # Copyright (c) 2017 Ashok P. Nadkarni #------------------------------------------------------------------------------ !ifndef _RULES_VC _RULES_VC = 1 # The following macros define the version of the rules.vc nmake build system # For modifications that are not backward-compatible, you *must* change # the major version. RULES_VERSION_MAJOR = 1 RULES_VERSION_MINOR = 1 # The PROJECT macro must be defined by parent makefile. !if "$(PROJECT)" == "" !error *** Error: Macro PROJECT not defined! Please define it before including rules.vc !endif !if "$(PRJ_PACKAGE_TCLNAME)" == "" PRJ_PACKAGE_TCLNAME = $(PROJECT) !endif # Also special case Tcl and Tk to save some typing later DOING_TCL = 0 DOING_TK = 0 !if "$(PROJECT)" == "tcl" DOING_TCL = 1 !elseif "$(PROJECT)" == "tk" DOING_TK = 1 !endif !ifndef NEED_TK # Backwards compatibility !ifdef PROJECT_REQUIRES_TK NEED_TK = $(PROJECT_REQUIRES_TK) !else NEED_TK = 0 !endif !endif !ifndef NEED_TCL_SOURCE NEED_TCL_SOURCE = 0 !endif !ifdef NEED_TK_SOURCE !if $(NEED_TK_SOURCE) NEED_TK = 1 !endif !else NEED_TK_SOURCE = 0 !endif ################################################################ # Nmake is a pretty weak environment in syntax and capabilities # so this file is necessarily verbose. It's broken down into # the following parts. # # 0. Sanity check that compiler environment is set up and initialize # any built-in settings from the parent makefile # 1. First define the external tools used for compiling, copying etc. # as this is independent of everything else. # 2. Figure out our build structure in terms of the directory, whether # we are building Tcl or an extension, etc. # 3. Determine the compiler and linker versions # 4. Build the nmakehlp helper application # 5. Determine the supported compiler options and features # 6. Parse the OPTS macro value for user-specified build configuration # 7. Parse the STATS macro value for statistics instrumentation # 8. Parse the CHECKS macro for additional compilation checks # 9. Extract Tcl, and possibly Tk, version numbers from the headers # 10. Based on this selected configuration, construct the output # directory and file paths # 11. Construct the paths where the package is to be installed # 12. Set up the actual options passed to compiler and linker based # on the information gathered above. # 13. Define some standard build targets and implicit rules. These may # be optionally disabled by the parent makefile. # 14. (For extensions only.) Compare the configuration of the target # Tcl and the extensions and warn against discrepancies. # # One final note about the macro names used. They are as they are # for historical reasons. We would like legacy extensions to # continue to work with this make include file so be wary of # changing them for consistency or clarity. # 0. Sanity check compiler environment # Check to see we are configured to build with MSVC (MSDEVDIR, MSVCDIR or # VCINSTALLDIR) or with the MS Platform SDK (MSSDK or WindowsSDKDir) !if !defined(MSDEVDIR) && !defined(MSVCDIR) && !defined(VCINSTALLDIR) && !defined(MSSDK) && !defined(WINDOWSSDKDIR) MSG = ^ Visual C++ compiler environment not initialized. !error $(MSG) !endif # We need to run from the directory the parent makefile is located in. # nmake does not tell us what makefile was used to invoke it so parent # makefile has to set the MAKEFILEVC macro or we just make a guess and # warn if we think that is not the case. !if "$(MAKEFILEVC)" == "" !if exist("$(PROJECT).vc") MAKEFILEVC = $(PROJECT).vc !elseif exist("makefile.vc") MAKEFILEVC = makefile.vc !endif !endif # "$(MAKEFILEVC)" == "" !if !exist("$(MAKEFILEVC)") MSG = ^ You must run nmake from the directory containing the project makefile.^ If you are doing that and getting this message, set the MAKEFILEVC^ macro to the name of the project makefile. !message WARNING: $(MSG) !endif ################################################################ # 1. Define external programs being used #---------------------------------------------------------- # Set the proper copy method to avoid overwrite questions # to the user when copying files and selecting the right # "delete all" method. #---------------------------------------------------------- RMDIR = rmdir /S /Q CPY = xcopy /i /y >NUL CPYDIR = xcopy /e /i /y >NUL COPY = copy /y >NUL MKDIR = mkdir ###################################################################### # 2. Figure out our build environment in terms of what we're building. # # (a) Tcl itself # (b) Tk # (c) a Tcl extension using libraries/includes from an *installed* Tcl # (d) a Tcl extension using libraries/includes from Tcl source directory # # This last is needed because some extensions still need # some Tcl interfaces that are not publicly exposed. # # The fragment will set the following macros: # ROOT - root of this module sources # COMPATDIR - source directory that holds compatibility sources # DOCDIR - source directory containing documentation files # GENERICDIR - platform-independent source directory # WINDIR - Windows-specific source directory # TESTDIR - directory containing test files # TOOLSDIR - directory containing build tools # _TCLDIR - root of the Tcl installation OR the Tcl sources. Not set # when building Tcl itself. # _INSTALLDIR - native form of the installation path. For Tcl # this will be the root of the Tcl installation. For extensions # this will be the lib directory under the root. # TCLINSTALL - set to 1 if _TCLDIR refers to # headers and libraries from an installed Tcl, and 0 if built against # Tcl sources. Not set when building Tcl itself. Yes, not very well # named. # _TCL_H - native path to the tcl.h file # # If Tk is involved, also sets the following # _TKDIR - native form Tk installation OR Tk source. Not set if building # Tk itself. # TKINSTALL - set 1 if _TKDIR refers to installed Tk and 0 if Tk sources # _TK_H - native path to the tk.h file # Root directory for sources and assumed subdirectories ROOT = $(MAKEDIR)\.. # The following paths CANNOT have spaces in them as they appear on the # left side of implicit rules. !ifndef COMPATDIR COMPATDIR = $(ROOT)\compat !endif !ifndef DOCDIR DOCDIR = $(ROOT)\doc !endif !ifndef GENERICDIR GENERICDIR = $(ROOT)\generic !endif !ifndef TOOLSDIR TOOLSDIR = $(ROOT)\tools !endif !ifndef TESTDIR TESTDIR = $(ROOT)\tests !endif !ifndef LIBDIR !if exist("$(ROOT)\library") LIBDIR = $(ROOT)\library !else LIBDIR = $(ROOT)\lib !endif !endif !ifndef DEMODIR !if exist("$(LIBDIR)\demos") DEMODIR = $(LIBDIR)\demos !else DEMODIR = $(ROOT)\demos !endif !endif # ifndef DEMODIR # Do NOT enclose WINDIR in a !ifndef because Windows always defines # WINDIR env var to point to c:\windows! # TBD - This is a potentially dangerous conflict, rename WINDIR to # something else WINDIR = $(ROOT)\win !ifndef RCDIR !if exist("$(WINDIR)\rc") RCDIR = $(WINDIR)\rc !else RCDIR = $(WINDIR) !endif !endif RCDIR = $(RCDIR:/=\) # The target directory where the built packages and binaries will be installed. # INSTALLDIR is the (optional) path specified by the user. # _INSTALLDIR is INSTALLDIR using the backslash separator syntax !ifdef INSTALLDIR ### Fix the path separators. _INSTALLDIR = $(INSTALLDIR:/=\) !else ### Assume the normal default. _INSTALLDIR = $(HOMEDRIVE)\Tcl !endif !if $(DOING_TCL) # BEGIN Case 2(a) - Building Tcl itself # Only need to define _TCL_H _TCL_H = ..\generic\tcl.h # END Case 2(a) - Building Tcl itself !elseif $(DOING_TK) # BEGIN Case 2(b) - Building Tk TCLINSTALL = 0 # Tk always builds against Tcl source, not an installed Tcl !if "$(TCLDIR)" == "" !if [echo TCLDIR = \> nmakehlp.out] \ || [nmakehlp -L generic\tcl.h >> nmakehlp.out] !error *** Could not locate Tcl source directory. !endif !include nmakehlp.out !endif # TCLDIR == "" _TCLDIR = $(TCLDIR:/=\) _TCL_H = $(_TCLDIR)\generic\tcl.h !if !exist("$(_TCL_H)") !error Could not locate tcl.h. Please set the TCLDIR macro to point to the Tcl *source* directory. !endif _TK_H = ..\generic\tk.h # END Case 2(b) - Building Tk !else # BEGIN Case 2(c) or (d) - Building an extension other than Tk # If command line has specified Tcl location through TCLDIR, use it # else default to the INSTALLDIR setting !if "$(TCLDIR)" != "" _TCLDIR = $(TCLDIR:/=\) !if exist("$(_TCLDIR)\include\tcl.h") # Case 2(c) with TCLDIR defined TCLINSTALL = 1 _TCL_H = $(_TCLDIR)\include\tcl.h !elseif exist("$(_TCLDIR)\generic\tcl.h") # Case 2(d) with TCLDIR defined TCLINSTALL = 0 _TCL_H = $(_TCLDIR)\generic\tcl.h !endif !else # # Case 2(c) for extensions with TCLDIR undefined # Need to locate Tcl depending on whether it needs Tcl source or not. # If we don't, check the INSTALLDIR for an installed Tcl first !if exist("$(_INSTALLDIR)\include\tcl.h") && !$(NEED_TCL_SOURCE) TCLINSTALL = 1 TCLDIR = $(_INSTALLDIR)\.. # NOTE: we will be resetting _INSTALLDIR to _INSTALLDIR/lib for extensions # later so the \.. accounts for the /lib _TCLDIR = $(_INSTALLDIR)\.. _TCL_H = $(_TCLDIR)\include\tcl.h !else # exist(...) && ! $(NEED_TCL_SOURCE) !if [echo _TCLDIR = \> nmakehlp.out] \ || [nmakehlp -L generic\tcl.h >> nmakehlp.out] !error *** Could not locate Tcl source directory. !endif !include nmakehlp.out TCLINSTALL = 0 TCLDIR = $(_TCLDIR) _TCL_H = $(_TCLDIR)\generic\tcl.h !endif # exist(...) && ! $(NEED_TCL_SOURCE) !endif # TCLDIR !ifndef _TCL_H MSG =^ Failed to find tcl.h. The TCLDIR macro is set incorrectly or is not set and default path does not contain tcl.h. !error $(MSG) !endif # Now do the same to locate Tk headers and libs if project requires Tk !if $(NEED_TK) !if "$(TKDIR)" != "" _TKDIR = $(TKDIR:/=\) !if exist("$(_TKDIR)\include\tk.h") TKINSTALL = 1 _TK_H = $(_TKDIR)\include\tk.h !elseif exist("$(_TKDIR)\generic\tk.h") TKINSTALL = 0 _TK_H = $(_TKDIR)\generic\tk.h !endif !else # TKDIR not defined # Need to locate Tcl depending on whether it needs Tcl source or not. # If we don't, check the INSTALLDIR for an installed Tcl first !if exist("$(_INSTALLDIR)\include\tk.h") && !$(NEED_TK_SOURCE) TKINSTALL = 1 # NOTE: we will be resetting _INSTALLDIR to _INSTALLDIR/lib for extensions # later so the \.. accounts for the /lib _TKDIR = $(_INSTALLDIR)\.. _TK_H = $(_TKDIR)\include\tk.h TKDIR = $(_TKDIR) !else # exist("$(_INSTALLDIR)\include\tk.h") && !$(NEED_TK_SOURCE) !if [echo _TKDIR = \> nmakehlp.out] \ || [nmakehlp -L generic\tk.h >> nmakehlp.out] !error *** Could not locate Tk source directory. !endif !include nmakehlp.out TKINSTALL = 0 TKDIR = $(_TKDIR) _TK_H = $(_TKDIR)\generic\tk.h !endif # exist("$(_INSTALLDIR)\include\tk.h") && !$(NEED_TK_SOURCE) !endif # TKDIR !ifndef _TK_H MSG =^ Failed to find tk.h. The TKDIR macro is set incorrectly or is not set and default path does not contain tk.h. !error $(MSG) !endif !endif # NEED_TK !if $(NEED_TCL_SOURCE) && $(TCLINSTALL) MSG = ^ *** Warning: This extension requires the source distribution of Tcl.^ *** Please set the TCLDIR macro to point to the Tcl sources. !error $(MSG) !endif !if $(NEED_TK_SOURCE) !if $(TKINSTALL) MSG = ^ *** Warning: This extension requires the source distribution of Tk.^ *** Please set the TKDIR macro to point to the Tk sources. !error $(MSG) !endif !endif # If INSTALLDIR set to tcl installation root dir then reset to the # lib dir for installing extensions !if exist("$(_INSTALLDIR)\include\tcl.h") _INSTALLDIR=$(_INSTALLDIR)\lib !endif # END Case 2(c) or (d) - Building an extension !endif # if $(DOING_TCL) ################################################################ # 3. Determine compiler version and architecture # In this section, we figure out the compiler version and the # architecture for which we are building. This sets the # following macros: # VCVERSION - the internal compiler version as 1200, 1400, 1910 etc. # This is also printed by the compiler in dotted form 19.10 etc. # VCVER - the "marketing version", for example Visual C++ 6 for internal # compiler version 1200. This is kept only for legacy reasons as it # does not make sense for recent Microsoft compilers. Only used for # output directory names. # ARCH - set to IX86 or AMD64 depending on 32- or 64-bit target # NATIVE_ARCH - set to IX86 or AMD64 for the host machine # MACHINE - same as $(ARCH) - legacy # _VC_MANIFEST_EMBED_{DLL,EXE} - commands for embedding a manifest if needed # CFG_ENCODING - set to an character encoding. # TBD - this is passed to compiler as TCL_CFGVAL_ENCODING but can't # see where it is used cc32 = $(CC) # built-in default. link32 = link lib32 = lib rc32 = $(RC) # built-in default. #---------------------------------------------------------------- # Figure out the compiler architecture and version by writing # the C macros to a file, preprocessing them with the C # preprocessor and reading back the created file _HASH=^# _VC_MANIFEST_EMBED_EXE= _VC_MANIFEST_EMBED_DLL= VCVER=0 !if ![echo VCVERSION=_MSC_VER > vercl.x] \ && ![echo $(_HASH)if defined(_M_IX86) >> vercl.x] \ && ![echo ARCH=IX86 >> vercl.x] \ && ![echo $(_HASH)elif defined(_M_AMD64) >> vercl.x] \ && ![echo ARCH=AMD64 >> vercl.x] \ && ![echo $(_HASH)endif >> vercl.x] \ && ![$(cc32) -nologo -TC -P vercl.x 2>NUL] !include vercl.i !if $(VCVERSION) < 1900 !if ![echo VCVER= ^\> vercl.vc] \ && ![set /a $(VCVERSION) / 100 - 6 >> vercl.vc] !include vercl.vc !endif !else # The simple calculation above does not apply to new Visual Studio releases # Keep the compiler version in its native form. VCVER = $(VCVERSION) !endif !endif !if ![del 2>NUL /q/f vercl.x vercl.i vercl.vc] !endif #---------------------------------------------------------------- # The MACHINE macro is used by legacy makefiles so set it as well !ifdef MACHINE !if "$(MACHINE)" == "x86" !undef MACHINE MACHINE = IX86 !elseif "$(MACHINE)" == "x64" !undef MACHINE MACHINE = AMD64 !endif !if "$(MACHINE)" != "$(ARCH)" !error Specified MACHINE macro $(MACHINE) does not match detected target architecture $(ARCH). !endif !else MACHINE=$(ARCH) !endif #------------------------------------------------------------ # Figure out the *host* architecture by reading the registry !if ![reg query HKLM\Hardware\Description\System\CentralProcessor\0 /v Identifier | findstr /i x86] NATIVE_ARCH=IX86 !else NATIVE_ARCH=AMD64 !endif # Since MSVC8 we must deal with manifest resources. !if $(VCVERSION) >= 1400 _VC_MANIFEST_EMBED_EXE=if exist [email protected] mt -nologo -manifest [email protected] -outputresource:$@;1 _VC_MANIFEST_EMBED_DLL=if exist [email protected] mt -nologo -manifest [email protected] -outputresource:$@;2 !endif !ifndef CFG_ENCODING CFG_ENCODING = \"cp1252\" !endif ################################################################ # 4. Build the nmakehlp program # This is a helper app we need to overcome nmake's limiting # environment. We will call out to it to get various bits of # information about supported compiler options etc. # # Tcl itself will always use the nmakehlp.c program which is # in its own source. This is the "master" copy and kept updated. # # Extensions built against an installed Tcl will use the installed # copy of Tcl's nmakehlp.c if there is one and their own version # otherwise. In the latter case, they would also be using their own # rules.vc. Note that older versions of Tcl do not install nmakehlp.c # or rules.vc. # # Extensions built against Tcl sources will use the one from the Tcl source. # # When building an extension using a sufficiently new version of Tcl, # rules-ext.vc will define NMAKEHLPC appropriately to point to the # copy of nmakehlp.c to be used. !ifndef NMAKEHLPC # Default to the one in the current directory (the extension's own nmakehlp.c) NMAKEHLPC = nmakehlp.c !if !$(DOING_TCL) !if $(TCLINSTALL) !if exist("$(_TCLDIR)\lib\nmake\nmakehlp.c") NMAKEHLPC = $(_TCLDIR)\lib\nmake\nmakehlp.c !endif !else # ! $(TCLINSTALL) !if exist("$(_TCLDIR)\win\nmakehlp.c") NMAKEHLPC = $(_TCLDIR)\win\nmakehlp.c !endif !endif # $(TCLINSTALL) !endif # !$(DOING_TCL) !endif # NMAKEHLPC # We always build nmakehlp even if it exists since we do not know # what source it was built from. !if [$(cc32) -nologo "$(NMAKEHLPC)" -link -subsystem:console > nul] !endif ################################################################ # 5. Test for compiler features # Visual C++ compiler options have changed over the years. Check # which options are supported by the compiler in use. # # The following macros are set: # OPTIMIZATIONS - the compiler flags to be used for optimized builds # DEBUGFLAGS - the compiler flags to be used for debug builds # LINKERFLAGS - Flags passed to the linker # # Note that these are the compiler settings *available*, not those # that will be *used*. The latter depends on the OPTS macro settings # which we have not yet parsed. # # Also note that some of the flags in OPTIMIZATIONS are not really # related to optimization. They are placed there only for legacy reasons # as some extensions expect them to be included in that macro. # -Op improves float consistency. Note only needed for older compilers # Newer compilers do not need or support this option. !if [nmakehlp -c -Op] FPOPTS = -Op !endif # Strict floating point semantics - present in newer compilers in lieu of -Op !if [nmakehlp -c -fp:strict] FPOPTS = $(FPOPTS) -fp:strict !endif !if "$(MACHINE)" == "IX86" ### test for pentium errata !if [nmakehlp -c -QI0f] !message *** Compiler has 'Pentium 0x0f fix' FPOPTS = $(FPOPTS) -QI0f !else !message *** Compiler does not have 'Pentium 0x0f fix' !endif !endif ### test for optimizations # /O2 optimization includes /Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy as per # documentation. Note we do NOT want /Gs as that inserts a _chkstk # stack probe at *every* function entry, not just those with more than # a page of stack allocation resulting in a performance hit. However, # /O2 documentation is misleading as its stack probes are simply the # default page size locals allocation probes and not what is implied # by an explicit /Gs option. OPTIMIZATIONS = $(FPOPTS) !if [nmakehlp -c -O2] OPTIMIZING = 1 OPTIMIZATIONS = $(OPTIMIZATIONS) -O2 !else # Legacy, really. All modern compilers support this !message *** Compiler does not have 'Optimizations' OPTIMIZING = 0 !endif # Checks for buffer overflows in local arrays !if [nmakehlp -c -GS] OPTIMIZATIONS = $(OPTIMIZATIONS) -GS !endif # Link time optimization. Note that this option (potentially) makes # generated libraries only usable by the specific VC++ version that # created it. Requires /LTCG linker option !if [nmakehlp -c -GL] OPTIMIZATIONS = $(OPTIMIZATIONS) -GL CC_GL_OPT_ENABLED = 1 !else # In newer compilers -GL and -YX are incompatible. !if [nmakehlp -c -YX] OPTIMIZATIONS = $(OPTIMIZATIONS) -YX !endif !endif # [nmakehlp -c -GL] DEBUGFLAGS = $(FPOPTS) # Run time error checks. Not available or valid in a release, non-debug build # RTC is for modern compilers, -GZ is legacy !if [nmakehlp -c -RTC1] DEBUGFLAGS = $(DEBUGFLAGS) -RTC1 !elseif [nmakehlp -c -GZ] DEBUGFLAGS = $(DEBUGFLAGS) -GZ !endif #---------------------------------------------------------------- # Linker flags # LINKER_TESTFLAGS are for internal use when we call nmakehlp to test # if the linker supports a specific option. Without these flags link will # return "LNK1561: entry point must be defined" error compiling from VS-IDE: # They are not passed through to the actual application / extension # link rules. !ifndef LINKER_TESTFLAGS LINKER_TESTFLAGS = /DLL /NOENTRY /OUT:nmakehlp.out !endif LINKERFLAGS = # If compiler has enabled link time optimization, linker must too with -ltcg !ifdef CC_GL_OPT_ENABLED !if [nmakehlp -l -ltcg $(LINKER_TESTFLAGS)] LINKERFLAGS = $(LINKERFLAGS) -ltcg !endif !endif ######################################################################## # 6. Parse the OPTS macro to work out the requested build configuration. # Based on this, we will construct the actual switches to be passed to the # compiler and linker using the macros defined in the previous section. # The following macros are defined by this section based on OPTS # STATIC_BUILD - 0 -> Tcl is to be built as a shared library # 1 -> build as a static library and shell # TCL_THREADS - legacy but always 1 on Windows since winsock requires it. # DEBUG - 1 -> debug build, 0 -> release builds # SYMBOLS - 1 -> generate PDB's, 0 -> no PDB's # PROFILE - 1 -> generate profiling info, 0 -> no profiling # PGO - 1 -> profile based optimization, 0 -> no # MSVCRT - 1 -> link to dynamic C runtime even when building static Tcl build # 0 -> link to static C runtime for static Tcl build. # Does not impact shared Tcl builds (STATIC_BUILD == 0) # TCL_USE_STATIC_PACKAGES - 1 -> statically link the registry and dde extensions # in the Tcl shell. 0 -> keep them as shared libraries # Does not impact shared Tcl builds. # USE_THREAD_ALLOC - 1 -> Use a shared global free pool for allocation. # 0 -> Use the non-thread allocator. # UNCHECKED - 1 -> when doing a debug build with symbols, use the release # C runtime, 0 -> use the debug C runtime. # USE_STUBS - 1 -> compile to use stubs interfaces, 0 -> direct linking # CONFIG_CHECK - 1 -> check current build configuration against Tcl # configuration (ignored for Tcl itself) # Further, LINKERFLAGS are modified based on above. # Default values for all the above STATIC_BUILD = 0 TCL_THREADS = 1 DEBUG = 0 SYMBOLS = 0 PROFILE = 0 PGO = 0 MSVCRT = 1 TCL_USE_STATIC_PACKAGES = 0 USE_THREAD_ALLOC = 1 UNCHECKED = 0 CONFIG_CHECK = 1 !if $(DOING_TCL) USE_STUBS = 0 !else USE_STUBS = 1 !endif # If OPTS is not empty AND does not contain "none" which turns off all OPTS # set the above macros based on OPTS content !if "$(OPTS)" != "" && ![nmakehlp -f "$(OPTS)" "none"] # OPTS are specified, parse them !if [nmakehlp -f $(OPTS) "static"] !message *** Doing static STATIC_BUILD = 1 !endif !if [nmakehlp -f $(OPTS) "nostubs"] !message *** Not using stubs USE_STUBS = 0 !endif !if [nmakehlp -f $(OPTS) "nomsvcrt"] !message *** Doing nomsvcrt MSVCRT = 0 !else !if [nmakehlp -f $(OPTS) "msvcrt"] !message *** Doing msvcrt MSVCRT = 1 !else !if !$(STATIC_BUILD) MSVCRT = 1 !else MSVCRT = 0 !endif !endif !endif # [nmakehlp -f $(OPTS) "nomsvcrt"] !if [nmakehlp -f $(OPTS) "staticpkg"] && $(STATIC_BUILD) !message *** Doing staticpkg TCL_USE_STATIC_PACKAGES = 1 !else TCL_USE_STATIC_PACKAGES = 0 !endif !if [nmakehlp -f $(OPTS) "nothreads"] !message *** Compile explicitly for non-threaded tcl TCL_THREADS = 0 USE_THREAD_ALLOC= 0 !else TCL_THREADS = 1 USE_THREAD_ALLOC= 1 !endif !if [nmakehlp -f $(OPTS) "symbols"] !message *** Doing symbols DEBUG = 1 !else DEBUG = 0 !endif !if [nmakehlp -f $(OPTS) "pdbs"] !message *** Doing pdbs SYMBOLS = 1 !else SYMBOLS = 0 !endif !if [nmakehlp -f $(OPTS) "profile"] !message *** Doing profile PROFILE = 1 !else PROFILE = 0 !endif !if [nmakehlp -f $(OPTS) "pgi"] !message *** Doing profile guided optimization instrumentation PGO = 1 !elseif [nmakehlp -f $(OPTS) "pgo"] !message *** Doing profile guided optimization PGO = 2 !else PGO = 0 !endif !if [nmakehlp -f $(OPTS) "loimpact"] !message *** Warning: ignoring option "loimpact" - deprecated on modern Windows. !endif # TBD - should get rid of this option !if [nmakehlp -f $(OPTS) "thrdalloc"] !message *** Doing thrdalloc USE_THREAD_ALLOC = 1 !endif !if [nmakehlp -f $(OPTS) "tclalloc"] USE_THREAD_ALLOC = 0 !endif !if [nmakehlp -f $(OPTS) "unchecked"] !message *** Doing unchecked UNCHECKED = 1 !else UNCHECKED = 0 !endif !if [nmakehlp -f $(OPTS) "noconfigcheck"] CONFIG_CHECK = 1 !else CONFIG_CHECK = 0 !endif !endif # "$(OPTS)" != "" && ... parsing of OPTS # Set linker flags based on above !if $(PGO) > 1 !if [nmakehlp -l -ltcg:pgoptimize $(LINKER_TESTFLAGS)] LINKERFLAGS = $(LINKERFLAGS:-ltcg=) -ltcg:pgoptimize !else MSG=^ This compiler does not support profile guided optimization. !error $(MSG) !endif !elseif $(PGO) > 0 !if [nmakehlp -l -ltcg:pginstrument $(LINKER_TESTFLAGS)] LINKERFLAGS = $(LINKERFLAGS:-ltcg=) -ltcg:pginstrument !else MSG=^ This compiler does not support profile guided optimization. !error $(MSG) !endif !endif ################################################################ # 7. Parse the STATS macro to configure code instrumentation # The following macros are set by this section: # TCL_MEM_DEBUG - 1 -> enables memory allocation instrumentation # 0 -> disables # TCL_COMPILE_DEBUG - 1 -> enables byte compiler logging # 0 -> disables # Default both are off TCL_MEM_DEBUG = 0 TCL_COMPILE_DEBUG = 0 !if "$(STATS)" != "" && ![nmakehlp -f "$(STATS)" "none"] !if [nmakehlp -f $(STATS) "memdbg"] !message *** Doing memdbg TCL_MEM_DEBUG = 1 !else TCL_MEM_DEBUG = 0 !endif !if [nmakehlp -f $(STATS) "compdbg"] !message *** Doing compdbg TCL_COMPILE_DEBUG = 1 !else TCL_COMPILE_DEBUG = 0 !endif !endif #################################################################### # 8. Parse the CHECKS macro to configure additional compiler checks # The following macros are set by this section: # WARNINGS - compiler switches that control the warnings level # TCL_NO_DEPRECATED - 1 -> disable support for deprecated functions # 0 -> enable deprecated functions # Defaults - Permit deprecated functions and warning level 3 TCL_NO_DEPRECATED = 0 WARNINGS = -W3 !if "$(CHECKS)" != "" && ![nmakehlp -f "$(CHECKS)" "none"] !if [nmakehlp -f $(CHECKS) "nodep"] !message *** Doing nodep check TCL_NO_DEPRECATED = 1 !endif !if [nmakehlp -f $(CHECKS) "fullwarn"] !message *** Doing full warnings check WARNINGS = -W4 !if [nmakehlp -l -warn:3 $(LINKER_TESTFLAGS)] LINKERFLAGS = $(LINKERFLAGS) -warn:3 !endif !endif !if [nmakehlp -f $(CHECKS) "64bit"] && [nmakehlp -c -Wp64] !message *** Doing 64bit portability warnings WARNINGS = $(WARNINGS) -Wp64 !endif !endif ################################################################ # 9. Extract various version numbers # For Tcl and Tk, version numbers are extracted from tcl.h and tk.h # respectively. For extensions, versions are extracted from the # configure.in or configure.ac from the TEA configuration if it # exists, and unset otherwise. # Sets the following macros: # TCL_MAJOR_VERSION # TCL_MINOR_VERSION # TCL_PATCH_LEVEL # TCL_VERSION # TK_MAJOR_VERSION # TK_MINOR_VERSION # TK_PATCH_LEVEL # TK_VERSION # DOTVERSION - set as (for example) 2.5 # VERSION - set as (for example 25) #-------------------------------------------------------------- !if [echo REM = This file is generated from rules.vc > versions.vc] !endif !if [echo TCL_MAJOR_VERSION = \>> versions.vc] \ && [nmakehlp -V "$(_TCL_H)" TCL_MAJOR_VERSION >> versions.vc] !endif !if [echo TCL_MINOR_VERSION = \>> versions.vc] \ && [nmakehlp -V "$(_TCL_H)" TCL_MINOR_VERSION >> versions.vc] !endif !if [echo TCL_PATCH_LEVEL = \>> versions.vc] \ && [nmakehlp -V "$(_TCL_H)" TCL_PATCH_LEVEL >> versions.vc] !endif !if defined(_TK_H) !if [echo TK_MAJOR_VERSION = \>> versions.vc] \ && [nmakehlp -V $(_TK_H) TK_MAJOR_VERSION >> versions.vc] !endif !if [echo TK_MINOR_VERSION = \>> versions.vc] \ && [nmakehlp -V $(_TK_H) TK_MINOR_VERSION >> versions.vc] !endif !if [echo TK_PATCH_LEVEL = \>> versions.vc] \ && [nmakehlp -V $(_TK_H) TK_PATCH_LEVEL >> versions.vc] !endif !endif # _TK_H !include versions.vc TCL_VERSION = $(TCL_MAJOR_VERSION)$(TCL_MINOR_VERSION) TCL_DOTVERSION = $(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION) !if defined(_TK_H) TK_VERSION = $(TK_MAJOR_VERSION)$(TK_MINOR_VERSION) TK_DOTVERSION = $(TK_MAJOR_VERSION).$(TK_MINOR_VERSION) !endif # Set DOTVERSION and VERSION !if $(DOING_TCL) DOTVERSION = $(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION) VERSION = $(TCL_VERSION) !elseif $(DOING_TK) DOTVERSION = $(TK_DOTVERSION) VERSION = $(TK_VERSION) !else # Doing a non-Tk extension # If parent makefile has not defined DOTVERSION, try to get it from TEA # first from a configure.in file, and then from configure.ac !ifndef DOTVERSION !if [echo DOTVERSION = \> versions.vc] \ || [nmakehlp -V $(ROOT)\configure.in ^[$(PROJECT)^] >> versions.vc] !if [echo DOTVERSION = \> versions.vc] \ || [nmakehlp -V $(ROOT)\configure.ac ^[$(PROJECT)^] >> versions.vc] !error *** Could not figure out extension version. Please define DOTVERSION in parent makefile before including rules.vc. !endif !endif !include versions.vc !endif # DOTVERSION VERSION = $(DOTVERSION:.=) !endif # $(DOING_TCL) ... etc. ################################################################ # 10. Construct output directory and file paths # Figure-out how to name our intermediate and output directories. # In order to avoid inadvertent mixing of object files built using # different compilers, build configurations etc., # # Naming convention (suffixes): # t = full thread support. # s = static library (as opposed to an import library) # g = linked to the debug enabled C run-time. # x = special static build when it links to the dynamic C run-time. # # The following macros are set in this section: # SUFX - the suffix to use for binaries based on above naming convention # BUILDDIRTOP - the toplevel default output directory # is of the form {Release,Debug}[_AMD64][_COMPILERVERSION] # TMP_DIR - directory where object files are created # OUT_DIR - directory where output executables are created # Both TMP_DIR and OUT_DIR are defaulted only if not defined by the # parent makefile (or command line). The default values are # based on BUILDDIRTOP. # STUBPREFIX - name of the stubs library for this project # PRJIMPLIB - output path of the generated project import library # PRJLIBNAME - name of generated project library # PRJLIB - output path of generated project library # PRJSTUBLIBNAME - name of the generated project stubs library # PRJSTUBLIB - output path of the generated project stubs library # RESFILE - output resource file (only if not static build) SUFX = tsgx !if $(DEBUG) BUILDDIRTOP = Debug !else BUILDDIRTOP = Release !endif |
︙ | ︙ | |||
372 373 374 375 376 377 378 379 | !endif !else !ifndef OUT_DIR OUT_DIR = $(TMP_DIR) !endif !endif | > > > > > > > > > > > > | > > | > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | < > | | < > > > > > > | > | > > > > > | | | > | > | > > > > > < > > > > > > > > < < < > > > > > > < < < | | > | | > > > > > > | | > > > > > > > > > < < | < < | > | < | > | > > > > | > > | > > > > > > > > > > > > > > > > > > | > > > | < > | < < < > > | | < | | < > | > > > > > | < > > > | < > > > > > > > > > > > > > > > > | 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 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 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 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 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 | !endif !else !ifndef OUT_DIR OUT_DIR = $(TMP_DIR) !endif !endif # Relative paths -> absolute !if [echo OUT_DIR = \> nmakehlp.out] \ || [nmakehlp -Q "$(OUT_DIR)" >> nmakehlp.out] !error *** Could not fully qualify path OUT_DIR=$(OUT_DIR) !endif !if [echo TMP_DIR = \>> nmakehlp.out] \ || [nmakehlp -Q "$(TMP_DIR)" >> nmakehlp.out] !error *** Could not fully qualify path TMP_DIR=$(TMP_DIR) !endif !include nmakehlp.out # The name of the stubs library for the project being built STUBPREFIX = $(PROJECT)stub # Set up paths to various Tcl executables and libraries needed by extensions !if $(DOING_TCL) TCLSHNAME = $(PROJECT)sh$(TCL_VERSION)$(SUFX).exe TCLSH = $(OUT_DIR)\$(TCLSHNAME) TCLIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib TCLLIBNAME = $(PROJECT)$(VERSION)$(SUFX).$(EXT) TCLLIB = $(OUT_DIR)\$(TCLLIBNAME) TCLSTUBLIBNAME = $(STUBPREFIX)$(VERSION).lib TCLSTUBLIB = $(OUT_DIR)\$(TCLSTUBLIBNAME) TCL_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)" !else # ! $(DOING_TCL) !if $(TCLINSTALL) # Building against an installed Tcl # When building extensions, we need to locate tclsh. Depending on version # of Tcl we are building against, this may or may not have a "t" suffix. # Try various possibilities in turn. TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX).exe !if !exist("$(TCLSH)") && $(TCL_THREADS) TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)t$(SUFX).exe !endif !if !exist("$(TCLSH)") TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX:t=).exe !endif TCLSTUBLIB = $(_TCLDIR)\lib\tclstub$(TCL_VERSION).lib TCLIMPLIB = $(_TCLDIR)\lib\tcl$(TCL_VERSION)$(SUFX).lib # When building extensions, may be linking against Tcl that does not add # "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility. !if !exist("$(TCLIMPLIB)") TCLIMPLIB = $(_TCLDIR)\lib\tcl$(TCL_VERSION)$(SUFX:t=).lib !endif TCL_LIBRARY = $(_TCLDIR)\lib TCLREGLIB = $(_TCLDIR)\lib\tclreg13$(SUFX:t=).lib TCLDDELIB = $(_TCLDIR)\lib\tcldde14$(SUFX:t=).lib TCLTOOLSDIR = \must\have\tcl\sources\to\build\this\target TCL_INCLUDES = -I"$(_TCLDIR)\include" !else # Building against Tcl sources TCLSH = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX).exe !if !exist($(TCLSH)) && $(TCL_THREADS) TCLSH = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)t$(SUFX).exe !endif !if !exist($(TCLSH)) TCLSH = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX:t=).exe !endif TCLSTUBLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib TCLIMPLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX).lib # When building extensions, may be linking against Tcl that does not add # "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility. !if !exist("$(TCLIMPLIB)") TCLIMPLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX:t=).lib !endif TCL_LIBRARY = $(_TCLDIR)\library TCLREGLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclreg13$(SUFX:t=).lib TCLDDELIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcldde14$(SUFX:t=).lib TCLTOOLSDIR = $(_TCLDIR)\tools TCL_INCLUDES = -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win" !endif # TCLINSTALL tcllibs = "$(TCLSTUBLIB)" "$(TCLIMPLIB)" !endif # $(DOING_TCL) # We need a tclsh that will run on the host machine as part of the build. # IX86 runs on all architectures. !ifndef TCLSH_NATIVE !if "$(MACHINE)" == "IX86" || "$(MACHINE)" == "$(NATIVE_ARCH)" TCLSH_NATIVE = $(TCLSH) !else !error You must explicitly set TCLSH_NATIVE for cross-compilation !endif !endif # Do the same for Tk and Tk extensions that require the Tk libraries !if $(DOING_TK) || $(NEED_TK) WISHNAMEPREFIX = wish WISHNAME = $(WISHNAMEPREFIX)$(TK_VERSION)$(SUFX).exe TKLIBNAME = $(PROJECT)$(TK_VERSION)$(SUFX).$(EXT) TKSTUBLIBNAME = tkstub$(TK_VERSION).lib TKIMPLIBNAME = tk$(TK_VERSION)$(SUFX).lib !if $(DOING_TK) WISH = $(OUT_DIR)\$(WISHNAME) TKSTUBLIB = $(OUT_DIR)\$(TKSTUBLIBNAME) TKIMPLIB = $(OUT_DIR)\$(TKIMPLIBNAME) TKLIB = $(OUT_DIR)\$(TKLIBNAME) TK_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)" !else # effectively NEED_TK !if $(TKINSTALL) # Building against installed Tk WISH = $(_TKDIR)\bin\$(WISHNAME) TKSTUBLIB = $(_TKDIR)\lib\$(TKSTUBLIBNAME) TKIMPLIB = $(_TKDIR)\lib\$(TKIMPLIBNAME) # When building extensions, may be linking against Tk that does not add # "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility. !if !exist("$(TKIMPLIB)") TKIMPLIBNAME = tk$(TK_VERSION)$(SUFX:t=).lib TKIMPLIB = $(_TKDIR)\lib\$(TKIMPLIBNAME) !endif TK_INCLUDES = -I"$(_TKDIR)\include" !else # Building against Tk sources WISH = $(_TKDIR)\win\$(BUILDDIRTOP)\$(WISHNAME) TKSTUBLIB = $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKSTUBLIBNAME) TKIMPLIB = $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKIMPLIBNAME) # When building extensions, may be linking against Tk that does not add # "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility. !if !exist("$(TKIMPLIB)") TKIMPLIBNAME = tk$(TK_VERSION)$(SUFX:t=).lib TKIMPLIB = $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKIMPLIBNAME) !endif TK_INCLUDES = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib" !endif # TKINSTALL tklibs = "$(TKSTUBLIB)" "$(TKIMPLIB)" !endif # $(DOING_TK) !endif # $(DOING_TK) || $(NEED_TK) # Various output paths PRJIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib PRJLIBNAME = $(PROJECT)$(VERSION)$(SUFX).$(EXT) PRJLIB = $(OUT_DIR)\$(PRJLIBNAME) PRJSTUBLIBNAME = $(STUBPREFIX)$(VERSION).lib PRJSTUBLIB = $(OUT_DIR)\$(PRJSTUBLIBNAME) # If extension parent makefile has not defined a resource definition file, # we will generate one from standard template. !if !$(DOING_TCL) && !$(DOING_TK) && !$(STATIC_BUILD) !ifdef RCFILE RESFILE = $(TMP_DIR)\$(RCFILE:.rc=.res) !else RESFILE = $(TMP_DIR)\$(PROJECT).res !endif !endif ################################################################### # 11. Construct the paths for the installation directories # The following macros get defined in this section: # LIB_INSTALL_DIR - where libraries should be installed # BIN_INSTALL_DIR - where the executables should be installed # DOC_INSTALL_DIR - where documentation should be installed # SCRIPT_INSTALL_DIR - where scripts should be installed # INCLUDE_INSTALL_DIR - where C include files should be installed # DEMO_INSTALL_DIR - where demos should be installed # PRJ_INSTALL_DIR - where package will be installed (not set for tcl and tk) !if $(DOING_TCL) || $(DOING_TK) LIB_INSTALL_DIR = $(_INSTALLDIR)\lib BIN_INSTALL_DIR = $(_INSTALLDIR)\bin DOC_INSTALL_DIR = $(_INSTALLDIR)\doc !if $(DOING_TCL) SCRIPT_INSTALL_DIR = $(_INSTALLDIR)\lib\$(PROJECT)$(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION) !else # DOING_TK SCRIPT_INSTALL_DIR = $(_INSTALLDIR)\lib\$(PROJECT)$(TK_MAJOR_VERSION).$(TK_MINOR_VERSION) !endif DEMO_INSTALL_DIR = $(SCRIPT_INSTALL_DIR)\demos INCLUDE_INSTALL_DIR = $(_INSTALLDIR)\include !else # extension other than Tk PRJ_INSTALL_DIR = $(_INSTALLDIR)\$(PROJECT)$(DOTVERSION) LIB_INSTALL_DIR = $(PRJ_INSTALL_DIR) BIN_INSTALL_DIR = $(PRJ_INSTALL_DIR) DOC_INSTALL_DIR = $(PRJ_INSTALL_DIR) SCRIPT_INSTALL_DIR = $(PRJ_INSTALL_DIR) DEMO_INSTALL_DIR = $(PRJ_INSTALL_DIR)\demos INCLUDE_INSTALL_DIR = $(_TCLDIR)\include !endif ################################################################### # 12. Set up actual options to be passed to the compiler and linker # Now we have all the information we need, set up the actual flags and # options that we will pass to the compiler and linker. The main # makefile should use these in combination with whatever other flags # and switches are specific to it. # The following macros are defined, names are for historical compatibility: # OPTDEFINES - /Dxxx C macro flags based on user-specified OPTS # COMPILERFLAGS - /Dxxx C macro flags independent of any configuration opttions # crt - Compiler switch that selects the appropriate C runtime # cdebug - Compiler switches related to debug AND optimizations # cwarn - Compiler switches that set warning levels # cflags - complete compiler switches (subsumes cdebug and cwarn) # ldebug - Linker switches controlling debug information and optimization # lflags - complete linker switches (subsumes ldebug) except subsystem type # dlllflags - complete linker switches to build DLLs (subsumes lflags) # conlflags - complete linker switches for console program (subsumes lflags) # guilflags - complete linker switches for GUI program (subsumes lflags) # baselibs - minimum Windows libraries required. Parent makefile can # define PRJ_LIBS before including rules.rc if additional libs are needed OPTDEFINES = -DTCL_CFGVAL_ENCODING=$(CFG_ENCODING) -DSTDC_HEADERS !if $(TCL_MEM_DEBUG) OPTDEFINES = $(OPTDEFINES) -DTCL_MEM_DEBUG !endif !if $(TCL_COMPILE_DEBUG) |
︙ | ︙ | |||
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | !if $(STATIC_BUILD) OPTDEFINES = $(OPTDEFINES) -DSTATIC_BUILD !endif !if $(TCL_NO_DEPRECATED) OPTDEFINES = $(OPTDEFINES) -DTCL_NO_DEPRECATED !endif !if !$(DEBUG) OPTDEFINES = $(OPTDEFINES) -DNDEBUG !if $(OPTIMIZING) OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_OPTIMIZED !endif !endif !if $(PROFILE) OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_PROFILED !endif | > > > > > > > > > > > | < | < > > | | > > > | | > > > < | < > > > > > > > > > > > > | | > > | > > | < | | < | > > > > > > > > > > | > | > | | > | | > > > > > > > | > > > | < < | | | < < < < | < | < > > > | > > > | | > | > > > > > | > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > | < < < < | < < | > | > > | > > > | | | | > > < < | | | > | > > > | > > < > > > > > | > | > > > > | > > < > > > | > | > > > | > > | < | | > | | > > | > | > > > | < > | | < > | | > | | > | < | < | | | | | > > > | | > > > > | > > > > < > > > > < | < > > > < > | > > > > > > > | < > > > > > > > | | | | > > | > | | | | < < | | > > > > > > | | | | | > | > > > > | | > > > | > | > | > > > > | < | | > > > > > > > > > > > > | < > > > > > > > > > < > < < | | < > > | < | > > > > > > | > > > > > > > > | < > > > > > > | > | | > > | > > | | < > > > > > | | < > | < | | > | > > | < | > > | > > < > > > > > | > > > > > > > > > > < | < < < | | 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 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 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 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 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 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 | !if $(STATIC_BUILD) OPTDEFINES = $(OPTDEFINES) -DSTATIC_BUILD !endif !if $(TCL_NO_DEPRECATED) OPTDEFINES = $(OPTDEFINES) -DTCL_NO_DEPRECATED !endif !if $(USE_STUBS) # Note we do not define USE_TCL_STUBS even when building tk since some # test targets in tk do not use stubs !if ! $(DOING_TCL) USE_STUBS_DEFS = -DUSE_TCL_STUBS -DUSE_TCLOO_STUBS !if $(NEED_TK) USE_STUBS_DEFS = $(USE_STUBS_DEFS) -DUSE_TK_STUBS !endif !endif !endif # USE_STUBS !if !$(DEBUG) OPTDEFINES = $(OPTDEFINES) -DNDEBUG !if $(OPTIMIZING) OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_OPTIMIZED !endif !endif !if $(PROFILE) OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_PROFILED !endif !if "$(MACHINE)" == "AMD64" OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_DO64BIT !endif !if $(VCVERSION) < 1300 OPTDEFINES = $(OPTDEFINES) -DNO_STRTOI64 !endif # _ATL_XP_TARGETING - Newer SDK's need this to build for XP COMPILERFLAGS = /D_ATL_XP_TARGETING # Following is primarily for the benefit of extensions. Tcl 8.5 builds # Tcl without /DUNICODE, while 8.6 builds with it defined. When building # an extension, it is advisable (but not mandated) to use the same Windows # API as the Tcl build. This is accordingly defaulted below. A particular # extension can override this by pre-definining USE_WIDECHAR_API. !ifndef USE_WIDECHAR_API !if $(TCL_VERSION) > 85 USE_WIDECHAR_API = 1 !else USE_WIDECHAR_API = 0 !endif !endif !if $(USE_WIDECHAR_API) COMPILERFLAGS = $(COMPILERFLAGS) /DUNICODE /D_UNICODE !endif # Like the TEA system only set this non empty for non-Tk extensions # Note: some extensions use PACKAGE_NAME and others use PACKAGE_TCLNAME # so we pass both !if !$(DOING_TCL) && !$(DOING_TK) PKGNAMEFLAGS = -DPACKAGE_NAME="\"$(PRJ_PACKAGE_TCLNAME)\"" \ -DPACKAGE_TCLNAME="\"$(PRJ_PACKAGE_TCLNAME)\"" \ -DPACKAGE_VERSION="\"$(DOTVERSION)\"" \ -DMODULE_SCOPE=extern !endif # crt picks the C run time based on selected OPTS !if $(MSVCRT) !if $(DEBUG) && !$(UNCHECKED) crt = -MDd !else crt = -MD !endif !else !if $(DEBUG) && !$(UNCHECKED) crt = -MTd !else crt = -MT !endif !endif # cdebug includes compiler options for debugging as well as optimization. !if $(DEBUG) # In debugging mode, optimizations need to be disabled cdebug = -Zi -Od $(DEBUGFLAGS) !else cdebug = $(OPTIMIZATIONS) !if $(SYMBOLS) cdebug = $(cdebug) -Zi !endif !endif # $(DEBUG) # cwarn includes default warning levels. cwarn = $(WARNINGS) !if "$(MACHINE)" == "AMD64" # Disable pointer<->int warnings related to cast between different sizes # There are a gadzillion of these due to use of ClientData and # clutter up compiler # output increasing chance of a real warning getting lost. So disable them. # Eventually some day, Tcl will be 64-bit clean. cwarn = $(cwarn) -wd4311 -wd4312 !endif ### Common compiler options that are architecture specific !if "$(MACHINE)" == "ARM" carch = -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE !else carch = !endif !if $(DEBUG) # Turn warnings into errors cwarn = $(cwarn) -WX !endif INCLUDES = $(TCL_INCLUDES) $(TK_INCLUDES) $(PRJ_INCLUDES) !if !$(DOING_TCL) && !$(DOING_TK) INCLUDES = $(INCLUDES) -I"$(GENERICDIR)" -I"$(WINDIR)" -I"$(COMPATDIR)" !endif # These flags are defined roughly in the order of the pre-reform # rules.vc/makefile.vc to help visually compare that the pre- and # post-reform build logs # cflags contains generic flags used for building practically all object files cflags = -nologo -c $(COMPILERFLAGS) $(carch) $(cwarn) -Fp$(TMP_DIR)^\ $(cdebug) # appcflags contains $(cflags) and flags for building the application # object files (e.g. tclsh, or wish) pkgcflags contains $(cflags) plus # flags used for building shared object files The two differ in the # BUILD_$(PROJECT) macro which should be defined only for the shared # library *implementation* and not for its caller interface appcflags = $(cflags) $(crt) $(INCLUDES) $(TCL_DEFINES) $(PRJ_DEFINES) $(OPTDEFINES) $(USE_STUBS_DEFS) appcflags_nostubs = $(cflags) $(crt) $(INCLUDES) $(TCL_DEFINES) $(PRJ_DEFINES) $(OPTDEFINES) pkgcflags = $(appcflags) $(PKGNAMEFLAGS) -DBUILD_$(PROJECT) pkgcflags_nostubs = $(appcflags_nostubs) $(PKGNAMEFLAGS) -DBUILD_$(PROJECT) # stubscflags contains $(cflags) plus flags used for building a stubs # library for the package. Note: -DSTATIC_BUILD is defined in # $(OPTDEFINES) only if the OPTS configuration indicates a static # library. However the stubs library is ALWAYS static hence included # here irrespective of the OPTS setting. # # TBD - tclvfs has a comment that stubs libs should not be compiled with -GL # without stating why. Tcl itself compiled stubs libs with this flag. # so we do not remove it from cflags. -GL may prevent extensions # compiled with one VC version to fail to link against stubs library # compiled with another VC version. Check for this and fix accordingly. stubscflags = $(cflags) $(PKGNAMEFLAGS) $(PRJ_DEFINES) $(OPTDEFINES) -Zl -DSTATIC_BUILD $(INCLUDES) # Link flags !if $(DEBUG) ldebug = -debug -debugtype:cv !else ldebug = -release -opt:ref -opt:icf,3 !if $(SYMBOLS) ldebug = $(ldebug) -debug -debugtype:cv !endif !endif # Note: Profiling is currently only possible with the Visual Studio Enterprise !if $(PROFILE) ldebug= $(ldebug) -profile !endif ### Declarations common to all linker versions lflags = -nologo -machine:$(MACHINE) $(LINKERFLAGS) $(ldebug) !if $(MSVCRT) && !($(DEBUG) && !$(UNCHECKED)) && $(VCVERSION) >= 1900 lflags = $(lflags) -nodefaultlib:libucrt.lib !endif # Old linkers (Visual C++ 6 in particular) will link for fast loading # on Win98. Since we do not support Win98 any more, we specify nowin98 # as recommended for NT and later. However, this is only required by # IX86 on older compilers and only needed if we are not doing a static build. !if "$(MACHINE)" == "IX86" && !$(STATIC_BUILD) !if [nmakehlp -l -opt:nowin98 $(LINKER_TESTFLAGS)] # Align sections for PE size savings. lflags = $(lflags) -opt:nowin98 !endif !endif dlllflags = $(lflags) -dll conlflags = $(lflags) -subsystem:console guilflags = $(lflags) -subsystem:windows # Libraries that are required for every image. # Extensions should define any additional libraries with $(PRJ_LIBS) winlibs = kernel32.lib advapi32.lib !if $(NEED_TK) winlibs = $(winlibs) gdi32.lib user32.lib uxtheme.lib !endif # Avoid 'unresolved external symbol __security_cookie' errors. # c.f. http://support.microsoft.com/?id=894573 !if "$(MACHINE)" == "AMD64" !if $(VCVERSION) > 1399 && $(VCVERSION) < 1500 winlibs = $(winlibs) bufferoverflowU.lib !endif !endif baselibs = $(winlibs) $(PRJ_LIBS) !if $(MSVCRT) && !($(DEBUG) && !$(UNCHECKED)) && $(VCVERSION) >= 1900 baselibs = $(baselibs) ucrt.lib !endif ################################################################ # 13. Define standard commands, common make targets and implicit rules CCPKGCMD = $(cc32) $(pkgcflags) -Fo$(TMP_DIR)^\ CCAPPCMD = $(cc32) $(appcflags) -Fo$(TMP_DIR)^\ CCSTUBSCMD = $(cc32) $(stubscflags) -Fo$(TMP_DIR)^\ LIBCMD = $(lib32) -nologo $(LINKERFLAGS) -out:$@ DLLCMD = $(link32) $(dlllflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs) CONEXECMD = $(link32) $(conlflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs) GUIEXECMD = $(link32) $(guilflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs) RESCMD = $(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" \ $(TCL_INCLUDES) \ -DDEBUG=$(DEBUG) -d UNCHECKED=$(UNCHECKED) \ -DCOMMAVERSION=$(DOTVERSION:.=,),0 \ -DDOTVERSION=\"$(DOTVERSION)\" \ -DVERSION=\"$(VERSION)\" \ -DSUFX=\"$(SUFX)\" \ -DPROJECT=\"$(PROJECT)\" \ -DPRJLIBNAME=\"$(PRJLIBNAME)\" !ifndef DEFAULT_BUILD_TARGET DEFAULT_BUILD_TARGET = $(PROJECT) !endif default-target: $(DEFAULT_BUILD_TARGET) default-pkgindex: @echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \ [list load [file join $$dir $(PRJLIBNAME)]] > $(OUT_DIR)\pkgIndex.tcl default-pkgindex-tea: @if exist $(ROOT)\pkgIndex.tcl.in nmakehlp -s << $(ROOT)\pkgIndex.tcl.in > $(OUT_DIR)\pkgIndex.tcl @PACKAGE_VERSION@ $(DOTVERSION) @PACKAGE_NAME@ $(PRJ_PACKAGE_TCLNAME) @PACKAGE_TCLNAME@ $(PRJ_PACKAGE_TCLNAME) @PKG_LIB_FILE@ $(PRJLIBNAME) << default-install: default-install-binaries default-install-libraries default-install-binaries: $(PRJLIB) @echo Installing binaries to '$(SCRIPT_INSTALL_DIR)' @if not exist "$(SCRIPT_INSTALL_DIR)" mkdir "$(SCRIPT_INSTALL_DIR)" @$(CPY) $(PRJLIB) "$(SCRIPT_INSTALL_DIR)" >NUL default-install-libraries: $(OUT_DIR)\pkgIndex.tcl @echo Installing libraries to '$(SCRIPT_INSTALL_DIR)' @if exist $(LIBDIR) $(CPY) $(LIBDIR)\*.tcl "$(SCRIPT_INSTALL_DIR)" @echo Installing package index in '$(SCRIPT_INSTALL_DIR)' @$(CPY) $(OUT_DIR)\pkgIndex.tcl $(SCRIPT_INSTALL_DIR) default-install-stubs: @echo Installing stubs library to '$(SCRIPT_INSTALL_DIR)' @if not exist "$(SCRIPT_INSTALL_DIR)" mkdir "$(SCRIPT_INSTALL_DIR)" @$(CPY) $(PRJSTUBLIB) "$(SCRIPT_INSTALL_DIR)" >NUL default-install-docs-html: @echo Installing documentation files to '$(DOC_INSTALL_DIR)' @if not exist "$(DOC_INSTALL_DIR)" mkdir "$(DOC_INSTALL_DIR)" @if exist $(DOCDIR) for %f in ("$(DOCDIR)\*.html" "$(DOCDIR)\*.css" "$(DOCDIR)\*.png") do @$(COPY) %f "$(DOC_INSTALL_DIR)" default-install-docs-n: @echo Installing documentation files to '$(DOC_INSTALL_DIR)' @if not exist "$(DOC_INSTALL_DIR)" mkdir "$(DOC_INSTALL_DIR)" @if exist $(DOCDIR) for %f in ("$(DOCDIR)\*.n") do @$(COPY) %f "$(DOC_INSTALL_DIR)" default-install-demos: @echo Installing demos to '$(DEMO_INSTALL_DIR)' @if not exist "$(DEMO_INSTALL_DIR)" mkdir "$(DEMO_INSTALL_DIR)" @if exist $(DEMODIR) $(CPYDIR) "$(DEMODIR)" "$(DEMO_INSTALL_DIR)" default-clean: @echo Cleaning $(TMP_DIR)\* ... @if exist $(TMP_DIR)\nul $(RMDIR) $(TMP_DIR) @echo Cleaning $(WINDIR)\nmakehlp.obj, nmakehlp.exe ... @if exist $(WINDIR)\nmakehlp.obj del $(WINDIR)\nmakehlp.obj @if exist $(WINDIR)\nmakehlp.exe del $(WINDIR)\nmakehlp.exe @if exist $(WINDIR)\nmakehlp.out del $(WINDIR)\nmakehlp.out @echo Cleaning $(WINDIR)\nmhlp-out.txt ... @if exist $(WINDIR)\nmhlp-out.txt del $(WINDIR)\nmhlp-out.txt @echo Cleaning $(WINDIR)\_junk.pch ... @if exist $(WINDIR)\_junk.pch del $(WINDIR)\_junk.pch @echo Cleaning $(WINDIR)\vercl.x, vercl.i ... @if exist $(WINDIR)\vercl.x del $(WINDIR)\vercl.x @if exist $(WINDIR)\vercl.i del $(WINDIR)\vercl.i @echo Cleaning $(WINDIR)\versions.vc, version.vc ... @if exist $(WINDIR)\versions.vc del $(WINDIR)\versions.vc @if exist $(WINDIR)\version.vc del $(WINDIR)\version.vc default-hose: default-clean @echo Hosing $(OUT_DIR)\* ... @if exist $(OUT_DIR)\nul $(RMDIR) $(OUT_DIR) # Only for backward compatibility default-distclean: default-hose default-setup: @if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR) @if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR) !if "$(TESTPAT)" != "" TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT) !endif default-test: default-setup $(PROJECT) @set TCLLIBPATH=$(OUT_DIR:\=/) @if exist $(LIBDIR) for %f in ("$(LIBDIR)\*.tcl") do @$(COPY) %f "$(OUT_DIR)" cd "$(TESTDIR)" && $(DEBUGGER) $(TCLSH) all.tcl $(TESTFLAGS) default-shell: default-setup $(PROJECT) @set TCLLIBPATH=$(OUT_DIR:\=/) @if exist $(LIBDIR) for %f in ("$(LIBDIR)\*.tcl") do @$(COPY) %f "$(OUT_DIR)" $(DEBUGGER) $(TCLSH) # Generation of Windows version resource !ifdef RCFILE # Note: don't use $** in below rule because there may be other dependencies # and only the "master" rc must be passed to the resource compiler $(TMP_DIR)\$(PROJECT).res: $(RCDIR)\$(PROJECT).rc $(RESCMD) $(RCDIR)\$(PROJECT).rc !else # If parent makefile has not defined a resource definition file, # we will generate one from standard template. $(TMP_DIR)\$(PROJECT).res: $(TMP_DIR)\$(PROJECT).rc $(TMP_DIR)\$(PROJECT).rc: @$(COPY) << $(TMP_DIR)\$(PROJECT).rc #include <winver.h> VS_VERSION_INFO VERSIONINFO FILEVERSION COMMAVERSION PRODUCTVERSION COMMAVERSION FILEFLAGSMASK 0x3fL #ifdef DEBUG FILEFLAGS VS_FF_DEBUG #else FILEFLAGS 0x0L #endif FILEOS VOS_NT_WINDOWS32 FILETYPE VFT_DLL FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904b0" BEGIN VALUE "FileDescription", "Tcl extension " PROJECT VALUE "OriginalFilename", PRJLIBNAME VALUE "FileVersion", DOTVERSION VALUE "ProductName", "Package " PROJECT " for Tcl" VALUE "ProductVersion", DOTVERSION END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1200 END END << !endif # ifdef RCFILE !ifndef DISABLE_IMPLICIT_RULES DISABLE_IMPLICIT_RULES = 0 !endif !if !$(DISABLE_IMPLICIT_RULES) # Implicit rule definitions - only for building library objects. For stubs and # main application, the master makefile should define explicit rules. {$(ROOT)}.c{$(TMP_DIR)}.obj:: $(CCPKGCMD) @<< $< << {$(WINDIR)}.c{$(TMP_DIR)}.obj:: $(CCPKGCMD) @<< $< << {$(GENERICDIR)}.c{$(TMP_DIR)}.obj:: $(CCPKGCMD) @<< $< << {$(COMPATDIR)}.c{$(TMP_DIR)}.obj:: $(CCPKGCMD) @<< $< << {$(RCDIR)}.rc{$(TMP_DIR)}.res: $(RESCMD) $< {$(WINDIR)}.rc{$(TMP_DIR)}.res: $(RESCMD) $< {$(TMP_DIR)}.rc{$(TMP_DIR)}.res: $(RESCMD) $< .SUFFIXES: .SUFFIXES:.c .rc !endif ################################################################ # 14. Sanity check selected options against Tcl build options # When building an extension, certain configuration options should # match the ones used when Tcl was built. Here we check and # warn on a mismatch. !if ! $(DOING_TCL) !if $(TCLINSTALL) # Building against an installed Tcl !if exist("$(_TCLDIR)\lib\nmake\tcl.nmake") TCLNMAKECONFIG = "$(_TCLDIR)\lib\nmake\tcl.nmake" !endif !else # ! $(TCLINSTALL) - building against Tcl source !if exist("$(OUT_DIR)\tcl.nmake") TCLNMAKECONFIG = "$(OUT_DIR)\tcl.nmake" !endif !endif # TCLINSTALL !if $(CONFIG_CHECK) !ifdef TCLNMAKECONFIG !include $(TCLNMAKECONFIG) !if defined(CORE_MACHINE) && "$(CORE_MACHINE)" != "$(MACHINE)" !error ERROR: Build target ($(MACHINE)) does not match the Tcl library architecture ($(CORE_MACHINE)). !endif !if defined(CORE_USE_THREAD_ALLOC) && $(CORE_USE_THREAD_ALLOC) != $(USE_THREAD_ALLOC) !message WARNING: Value of USE_THREAD_ALLOC ($(USE_THREAD_ALLOC)) does not match its Tcl core value ($(CORE_USE_THREAD_ALLOC)). !endif !if defined(CORE_DEBUG) && $(CORE_DEBUG) != $(DEBUG) !message WARNING: Value of DEBUG ($(DEBUG)) does not match its Tcl library configuration ($(DEBUG)). !endif !endif !endif # TCLNMAKECONFIG !endif # ! $(DOING_TCL) #---------------------------------------------------------- # Display stats being used. #---------------------------------------------------------- !if !$(DOING_TCL) !message *** Building against Tcl at '$(_TCLDIR)' !endif !if !$(DOING_TK) && $(NEED_TK) !message *** Building against Tk at '$(_TKDIR)' !endif !message *** Intermediate directory will be '$(TMP_DIR)' !message *** Output directory will be '$(OUT_DIR)' !message *** Installation, if selected, will be in '$(_INSTALLDIR)' !message *** Suffix for binaries will be '$(SUFX)' !message *** Compiler version $(VCVER). Target $(MACHINE), host $(NATIVE_ARCH). !endif # ifdef _RULES_VC |
Added win/targets.vc.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 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 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 95 96 97 98 | #------------------------------------------------------------- -*- makefile -*- # targets.vc -- # # Part of the nmake based build system for Tcl and its extensions. # This file defines some standard targets for the convenience of extensions # and can be optionally included by the extension makefile. # See TIP 477 (https://core.tcl.tk/tips/doc/trunk/tip/477.md) for docs. $(PROJECT): setup pkgindex $(PRJLIB) !ifdef PRJ_STUBOBJS $(PROJECT): $(PRJSTUBLIB) $(PRJSTUBLIB): $(PRJ_STUBOBJS) $(LIBCMD) $** $(PRJ_STUBOBJS): $(CCSTUBSCMD) %s !endif # PRJ_STUBOBJS !ifdef PRJ_MANIFEST $(PROJECT): $(PRJLIB).manifest $(PRJLIB).manifest: $(PRJ_MANIFEST) @nmakehlp -s << $** >$@ @MACHINE@ $(MACHINE:IX86=X86) << !endif !if "$(PROJECT)" != "tcl" && "$(PROJECT)" != "tk" $(PRJLIB): $(PRJ_OBJS) $(RESFILE) !if $(STATIC_BUILD) $(LIBCMD) $** !else $(DLLCMD) $** $(_VC_MANIFEST_EMBED_DLL) !endif -@del $*.exp !endif !if "$(PRJ_HEADERS)" != "" && "$(PRJ_OBJS)" != "" $(PRJ_OBJS): $(PRJ_HEADERS) !endif # If parent makefile has defined stub objects, add their installation # to the default install !if "$(PRJ_STUBOBJS)" != "" default-install: default-install-stubs !endif # Unlike the other default targets, these cannot be in rules.vc because # the executed command depends on existence of macro PRJ_HEADERS_PUBLIC # that the parent makefile will not define until after including rules-ext.vc !if "$(PRJ_HEADERS_PUBLIC)" != "" default-install: default-install-headers default-install-headers: @echo Installing headers to '$(INCLUDE_INSTALL_DIR)' @for %f in ($(PRJ_HEADERS_PUBLIC)) do @$(COPY) %f "$(INCLUDE_INSTALL_DIR)" !endif !if "$(DISABLE_STANDARD_TARGETS)" == "" DISABLE_STANDARD_TARGETS = 0 !endif !if "$(DISABLE_TARGET_setup)" == "" DISABLE_TARGET_setup = 0 !endif !if "$(DISABLE_TARGET_install)" == "" DISABLE_TARGET_install = 0 !endif !if "$(DISABLE_TARGET_clean)" == "" DISABLE_TARGET_clean = 0 !endif !if "$(DISABLE_TARGET_test)" == "" DISABLE_TARGET_test = 0 !endif !if "$(DISABLE_TARGET_shell)" == "" DISABLE_TARGET_shell = 0 !endif !if !$(DISABLE_STANDARD_TARGETS) !if !$(DISABLE_TARGET_setup) setup: default-setup !endif !if !$(DISABLE_TARGET_install) install: default-install !endif !if !$(DISABLE_TARGET_clean) clean: default-clean realclean: hose hose: default-hose distclean: realclean default-distclean !endif !if !$(DISABLE_TARGET_test) test: default-test !endif !if !$(DISABLE_TARGET_shell) shell: default-shell !endif !endif # DISABLE_STANDARD_TARGETS |
Changes to win/tkWinDialog.c.
︙ | ︙ | |||
640 641 642 643 644 645 646 | static void LoadShellProcs() { static HMODULE shell32_handle = NULL; if (shell32_handle != NULL) return; /* We have already been through here. */ | < < < < < | | 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 | static void LoadShellProcs() { static HMODULE shell32_handle = NULL; if (shell32_handle != NULL) return; /* We have already been through here. */ shell32_handle = GetModuleHandle(TEXT("shell32.dll")); if (shell32_handle == NULL) /* Should never happen but check anyways. */ return; ShellProcs.SHCreateItemFromParsingName = (SHCreateItemFromParsingNameProc*) GetProcAddress(shell32_handle, "SHCreateItemFromParsingName"); } |
︙ | ︙ |
Changes to win/tkWinMenu.c.
︙ | ︙ | |||
2078 2079 2080 2081 2082 2083 2084 | WM_SYSKEYUP, VK_MENU, (int) (scanCode << 16) | (1 << 29) | (1 << 30) | (1 << 31)); break; case XK_Alt_R: scanCode = MapVirtualKey(VK_RMENU, 0); CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)), WM_SYSKEYUP, VK_MENU, (int) (scanCode << 16) | (1 << 24) | | | 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 | WM_SYSKEYUP, VK_MENU, (int) (scanCode << 16) | (1 << 29) | (1 << 30) | (1 << 31)); break; case XK_Alt_R: scanCode = MapVirtualKey(VK_RMENU, 0); CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)), WM_SYSKEYUP, VK_MENU, (int) (scanCode << 16) | (1 << 24) | (1 << 29) | (1 << 30) | (1 << 31)); break; case XK_F10: scanCode = MapVirtualKey(VK_F10, 0); CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)), WM_SYSKEYUP, VK_F10, (int) (scanCode << 16) | (1 << 30) | (1 << 31)); break; |
︙ | ︙ |
Changes to xlib/X11/Xlib.h.
︙ | ︙ | |||
199 200 201 202 203 204 205 206 207 208 209 210 211 212 | VisualID visualid; /* visual id of this visual */ #if defined(__cplusplus) || defined(c_plusplus) int c_class; /* C++ class of screen (monochrome, etc.) */ #else int class; /* class of screen (monochrome, etc.) */ #endif unsigned long red_mask, green_mask, blue_mask; /* mask values */ int bits_per_rgb; /* log base 2 of distinct color values */ int map_entries; /* color map entries */ } Visual; /* * Depth structure; contains information for each possible depth. */ | > > > | 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | VisualID visualid; /* visual id of this visual */ #if defined(__cplusplus) || defined(c_plusplus) int c_class; /* C++ class of screen (monochrome, etc.) */ #else int class; /* class of screen (monochrome, etc.) */ #endif unsigned long red_mask, green_mask, blue_mask; /* mask values */ #if defined(MAC_OSX_TK) unsigned long alpha_mask; #endif int bits_per_rgb; /* log base 2 of distinct color values */ int map_entries; /* color map entries */ } Visual; /* * Depth structure; contains information for each possible depth. */ |
︙ | ︙ | |||
328 329 330 331 332 333 334 335 336 337 338 339 340 341 | int bits_per_pixel; /* bits per pixel (ZPixmap) */ unsigned long red_mask; /* bits in z arrangment */ unsigned long green_mask; unsigned long blue_mask; XPointer obdata; /* hook for the object routines to hang on */ #if defined(MAC_OSX_TK) int pixelpower; /* n such that pixels are 2^n x 2^n blocks*/ #endif struct funcs { /* image manipulation routines */ struct _XImage *(*create_image)(); #if NeedFunctionPrototypes int (*destroy_image) (struct _XImage *); unsigned long (*get_pixel) (struct _XImage *, int, int); int (*put_pixel) (struct _XImage *, int, int, unsigned long); | > | 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | int bits_per_pixel; /* bits per pixel (ZPixmap) */ unsigned long red_mask; /* bits in z arrangment */ unsigned long green_mask; unsigned long blue_mask; XPointer obdata; /* hook for the object routines to hang on */ #if defined(MAC_OSX_TK) int pixelpower; /* n such that pixels are 2^n x 2^n blocks*/ unsigned long alpha_mask; #endif struct funcs { /* image manipulation routines */ struct _XImage *(*create_image)(); #if NeedFunctionPrototypes int (*destroy_image) (struct _XImage *); unsigned long (*get_pixel) (struct _XImage *, int, int); int (*put_pixel) (struct _XImage *, int, int, unsigned long); |
︙ | ︙ |