Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch mac_services Excluding Merge-Ins
This is equivalent to a diff from 777211ed to a5d55621
2019-06-15
| ||
20:02 | TIP 536: Improvements to Mac-specific IPC check-in: ded88b70 user: dkf tags: core-8-6-branch | |
2019-05-20
| ||
13:21 | Edited README. Closed-Leaf check-in: a5d55621 user: culler tags: mac_services | |
02:33 | Add documentation on testing Mac services to README; remove obsolete detail from README; remove stub procedure for ::tk::mac::PerformService now that we have verified it works, to be consistent with other Mac-spdecific procedures such as ::tk::mac::OpenDocument check-in: 356d52c7 user: kevin_walzer tags: mac_services | |
2019-05-18
| ||
13:05 | Finally got timing of initializing NSServices object correct; code cleanup; merge in 8.6 to pick up changes in Tk initialization code check-in: f126b00e user: kevin_walzer tags: mac_services | |
2019-05-17
| ||
12:38 | In Aqua, protect against double release of clipping regions. check-in: 1304e06d user: culler tags: core-8-6-branch | |
07:28 | Merge 8.6 check-in: 701036f9 user: jan.nijtmans tags: trunk | |
07:21 | Add missing INT2PTR (doesn't cause warning with Tcl8.x, but does with Tcl 9.0). One None -> NULL change which was still missing. Backported from trunk. check-in: 777211ed user: jan.nijtmans tags: core-8-6-branch | |
2019-05-16
| ||
19:54 | Fix bug [d1989fb7cf]: In Aqua the root window appears before Tk_Mainloop is called. check-in: 364c9099 user: culler tags: core-8-6-branch | |
Changes to doc/tk_mac.n.
︙ | |||
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | 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 | + + + + | \fB::tk::mac::ReopenApplication\fR \fB::tk::mac::OpenDocument \fIfile...\fR \fB::tk::mac::PrintDocument \fIfile...\fR \fB::tk::mac::Quit\fR \fB::tk::mac::OnHide\fR \fB::tk::mac::OnShow\fR \fB::tk::mac::ShowHelp\fR \fB::tk::mac::PerformService\fR \fB::tk::mac::LaunchURL \fIURL...\fR \fB::tk::mac::GetAppPath\fR \fB::tk::mac::standardAboutPanel\fR \fB::tk::mac::useCompatibilityMetrics \fIboolean\fR \fB::tk::mac::CGAntialiasLimit \fIlimit\fR \fB::tk::mac::antialiasedtext \fInumber\fR \fB::tk::mac::useThemedToplevel \fIboolean\fR \fB::tk::mac::iconBitmap \fIname width height \-kind value\fR .fi .BE .SH "EVENT HANDLER CALLBACKS" .PP The Aqua/Mac OS X application environment defines a number of additional |
︙ | |||
106 107 108 109 110 111 112 | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | - - + + - | .RE .TP \fB::tk::mac::PrintDocument \fIfile...\fR . If a proc of this name is defined it is the default Apple Event handler for kAEPrintDocuments, .QW pdoc , |
︙ | |||
137 138 139 140 141 142 143 | 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 | - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | .TP \fB::tk::mac::ShowHelp\fR . Customizes behavior of Apple Help menu; if this procedure is not defined, the platform-specific standard Help menu item .QW "YourApp Help" performs the default Cocoa action of showing the Help Book configured in the |
︙ |
Changes to library/entry.tcl.
︙ | |||
70 71 72 73 74 75 76 77 78 79 80 81 82 83 | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | + + + + + | bind Entry <<TraverseIn>> { %W selection range 0 end %W icursor end } # Standard Motif bindings: bind Entry <Map> { if {[tk windowingsystem] eq "aqua"} { ::tk::RegisterServiceWidget %W } } bind Entry <1> { tk::EntryButton1 %W %x %W selection clear } bind Entry <B1-Motion> { set tk::Priv(x) %x tk::EntryMouseSelect %W %x |
︙ | |||
648 649 650 651 652 653 654 | 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | + + + + + + + + + | [expr {[$w index sel.last] - 1}]] if {[$w cget -show] ne ""} { return [string repeat [string index [$w cget -show] 0] \ [string length $entryString]] } return $entryString } |
Changes to library/text.tcl.
︙ | |||
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | + + + + + + + + | # and auto-scanning. # #------------------------------------------------------------------------- #------------------------------------------------------------------------- # The code below creates the default class bindings for text widgets. #------------------------------------------------------------------------- # Standard Motif bindings: bind Text <Map> { if {[tk windowingsystem] eq "aqua"} { ::tk::RegisterServiceWidget %W } } bind Text <1> { tk::TextButton1 %W %x %y %W tag remove sel 0.0 end } bind Text <B1-Motion> { set tk::Priv(x) %x |
︙ | |||
79 80 81 82 83 84 85 86 87 88 89 90 91 92 | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | + | } bind Text <B1-Enter> { tk::CancelRepeat } bind Text <ButtonRelease-1> { tk::CancelRepeat } bind Text <Control-1> { %W mark set insert @%x,%y # An operation that moves the insert mark without making it # one end of the selection must insert an autoseparator if {[%W cget -autoseparators]} { %W edit separator } |
︙ | |||
1199 1200 1201 1202 1203 1204 1205 | 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 | - + + | set Priv(y) $y } if {($x != $Priv(x)) || ($y != $Priv(y))} { set Priv(mouseMoved) 1 } if {[info exists Priv(mouseMoved)] && $Priv(mouseMoved)} { $w scan dragto $x $y |
Changes to library/tk.tcl.
︙ | |||
679 680 681 682 683 684 685 686 687 688 689 690 691 692 | 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 | + + + + + + + + | # For now, turn off the custom mdef proc for the mac: if {[tk windowingsystem] eq "aqua"} { namespace eval ::tk::mac { set useCustomMDEF 0 } } #register to send data to macOS Services if {[tk windowingsystem] eq "aqua"} { proc ::tk::RegisterServiceWidget {w} { ::tk::mac::registerServiceWidget $w } } # Run the Ttk themed widget set initialization if {$::ttk::library ne ""} { uplevel \#0 [list source $::ttk::library/ttk.tcl] } # Local Variables: |
︙ |
Changes to library/ttk/entry.tcl.
︙ | |||
53 54 55 56 57 58 59 60 61 62 63 64 65 66 | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | + + + + + + + | # Judgment call. If <Meta> happens to be assigned to the Alt key, # these could conflict with application accelerators. # (Plus, who has a Meta key these days?) # <Control-Key-t>: # Another judgment call. If anyone misses this, let me know # and I'll put it back. # ##Bindings to register with macOS Services API. bind T.Entry <Map> { if {[tk windowingsystem] eq "aqua"} { ::tk::RegisterServiceWidget %W } } ## Clipboard events: # bind TEntry <<Cut>> { ttk::entry::Cut %W } bind TEntry <<Copy>> { ttk::entry::Copy %W } bind TEntry <<Paste>> { ttk::entry::Paste %W } bind TEntry <<Clear>> { ttk::entry::Clear %W } |
︙ |
Changes to macosx/README.
︙ | |||
55 56 57 58 59 60 61 | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | - - - - - | $HOME/Library/Frameworks /Library/Frameworks /System/Library/Frameworks (searched in that order). Given a potential package directory $pkg, Tcl on OSX checks for the file $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. |
︙ | |||
83 84 85 86 87 88 89 | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | - - - - - - - - - - - - - - - - - - - - - - | - the env array is different when Wish is started from the Finder (i.e. via LaunchServices) than when it (or tclsh) is invoked from the Terminal, in particular PATH may not be what you expect. (Wish started by LaunchServices inherits loginwindow's environment variables, which are essentially those set in $HOME/.MacOSX/environment.plist, and are unrelated to those set in your shell). |
︙ | |||
332 333 334 335 336 337 338 | 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | - - - + | dialog window and the others match the contrasting background colors used in ttk::notebooks and ttk::labelframes which are nested to the corresponding depth. 5. Building Tcl/Tk on macOS ------------------------------ |
︙ | |||
393 394 395 396 397 398 399 | 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | - - - - - - - - - - - | the TCL_SRCROOT and TK_SRCROOT user build settings, by default these are set to the project-relative paths '../../tcl' and '../../tk', if your source 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. |
︙ | |||
708 709 710 711 712 713 714 | 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 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | 10.14 supports system appearance changes, and has added a "Dark Mode" that casts all window frames and menus as black. Tk 8.6.9 has added two virtual events, <<LightAqua>> and <<DarkAqua>>, to allow you to update your Tk app's appearance when the system appearance changes. Just bind your appearance-updating code to these virtual events and you will see it triggered when the system appearance toggles between dark and light. 7.0 Mac Services ~~~~~~~~~~~~~~~~~~~~~~~~~~~ With 8.6.10, Tk supports the Mac's NSServices API, documented at https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/SysServices/introduction.html#//apple_ref/doc/uid/10000101-SW1 and in TIP 536 and Tk's man page. Tk presents a simple, straightforward API to implement the Services functionality. The Tk implementation of the NSServices API is intended for standalone applications, such as one wrapped by the standalone version of Wish and re-named into a different application. In particular such an application would specify its own unique CFBundleIdentifier in its Info.plist file. During development, however, if Wish itself is being used as the receiver, it may be necessary to take some care to ensure that the correct version of Wish.app is available as a receiver of NSServices data. When one macOS app uses NSServices to send data to another app that is not running, LaunchServices will launch the receiver. LaunchServices assumes that the CFBundleIdentifier uniquely identifies an app among all of the apps installed on a system. But this may not be the case for Wish.app if, for example, you have compiled Tk from source at some time in the past. In that case the Tk build directory will contain its own copy of Wish.app that will be visible to LaunchServices. It may be necessary when testing your app to take some steps to ensure that LaunchServices is launching the correct Wish.app. Instructions for doing this are provided below. The command line tool which manages the LaunchServices database has an amazingly unwieldy path name. So, first, run this command: alias lsregister='/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister' Then you can reset the LaunchServices database like this: $ lsregister -kill $ lsregister -seed To find out which versions of Wish.app have been located by LaunchServices, run: $ lsregister -dump | grep path | grep Wish If more than one version of Wish is showing up in this list, eliminate all of the unintended targets by running lsregister -u /path/to/bad/Wish.app Continue this until only the correct version of Wish shows up in the list. |
Changes to macosx/Wish-Info.plist.in.
︙ | |||
32 33 34 35 36 37 38 39 40 41 42 43 44 45 | 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 | + + + + + + + + + + + + + | <string>TEXT</string> <string>****</string> </array> <key>CFBundleTypeRole</key> <string>Viewer</string> </dict> </array> <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleTypeRole</key> <string>Viewer</string> <key>CFBundleURLSchemes</key> <array> <string>foo</string> </array> <key>CFBundleURLName</key> <string>Get Foo</string> </dict> </array> <key>CFBundleExecutable</key> <string>Wish</string> <key>CFBundleGetInfoString</key> <string>Wish Shell @TK_VERSION@@TK_PATCH_LEVEL@, Copyright © 1989-@TK_YEAR@ Tcl Core Team, Copyright © 1989-@TK_YEAR@ Contributors, Copyright © 2011-@TK_YEAR@ Kevin Walzer/WordTech |
︙ | |||
74 75 76 77 78 79 80 | 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 | + + + + + + + - + + + + + + + + + + + + + + + | <true/> <key>NSAppleScriptEnabled</key> <true/> <key>OSAScriptingDefinition</key> <string>Wish.sdef</string> <key>NSHighResolutionCapable</key> <string>True</string> <key>NSServices</key> <array> <dict> <key>NSMenuItem</key> <dict> <key>default</key> <string>Wish: Display Test Data</string> |
Changes to macosx/Wish.sdef.
︙ | |||
24 25 26 27 28 29 30 31 32 33 34 35 36 37 | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | + + + + + + + + + | </command> <command name="quit" code="aevtquit" description="Quit the application."/> </suite> <suite name="Wish Suite" code="WIsH" description="Commands for the Wish application."> <command name="do script" code="miscdosc" description="Execute a Tcl script."> <direct-parameter description="Script to execute" type="text"> <type type="text"/> </direct-parameter> <result description="Result"> <type type="text"/> </result> </command> <command name="open location" code="GURLGURL" description="Open a URL."> <direct-parameter description="URL" type="text"> <type type="text"/> </direct-parameter> <result description="Result"> <type type="text"/> </result> </command> </suite> </dictionary> |
Changes to macosx/tkMacOSXHLEvents.c.
︙ | |||
122 123 124 125 126 127 128 | 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 | + + + + + + - - + + + + + + + + + + + | { tkMacOSXProcessFiles(event, replyEvent, _eventInterp, "::tk::mac::OpenDocument"); } - (void) handlePrintDocumentsEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent { NSString* file = [[event paramDescriptorForKeyword:keyDirectObject] stringValue]; const char *printFile=[file UTF8String]; Tcl_DString print; Tcl_DStringInit(&print); |
︙ | |||
242 243 244 245 246 247 248 249 250 251 252 253 254 255 | 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 | + + + + + + + + + + + + + + + + + + + + | result, reslen); AEPutParamPtr((AppleEvent*)[replyEvent aeDesc], keyErrorNumber, typeSInt32, (Ptr) &tclErr,sizeof(int)); } } return; } - (void)handleURLEvent:(NSAppleEventDescriptor*)event withReplyEvent:(NSAppleEventDescriptor*)replyEvent { NSString* url = [[event paramDescriptorForKeyword:keyDirectObject] stringValue]; const char *cURL=[url UTF8String]; Tcl_DString launch; Tcl_DStringInit(&launch); if (Tcl_FindCommand(_eventInterp, "::tk::mac::LaunchURL", NULL, 0)) { Tcl_DStringAppend(&launch, "::tk::mac::LaunchURL", -1); } Tcl_DStringAppendElement(&launch, cURL); int tclErr = Tcl_EvalEx(_eventInterp, Tcl_DStringValue(&launch), Tcl_DStringLength(&launch), TCL_EVAL_GLOBAL); if (tclErr!= TCL_OK) { Tcl_BackgroundException(_eventInterp, tclErr); } } @end #pragma mark - /* *---------------------------------------------------------------------- * |
︙ | |||
405 406 407 408 409 410 411 | 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 | - + + + + + + | forEventClass:kCoreEventClass andEventID:kAEShowPreferences]; [aeManager setEventHandler:NSApp andSelector:@selector(handleOpenDocumentsEvent:withReplyEvent:) forEventClass:kCoreEventClass andEventID:kAEOpenDocuments]; [aeManager setEventHandler:NSApp |
︙ |
Changes to macosx/tkMacOSXInit.c.
︙ | |||
112 113 114 115 116 117 118 119 120 121 122 123 124 125 | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | + | */ 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]; |
︙ | |||
331 332 333 334 335 336 337 | 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | - + | * If the root window is mapped before the App has finished launching * it will open off screen (see ticket 56a1823c73). To avoid this we * ask Tk to process an event with no wait. We expect Tcl_DoOneEvent * to wait until the Mac event loop has been created and then return * immediately since the queue is empty. */ |
︙ | |||
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 | 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 | + + + + + + + + + + + | if (scriptPath[0] != '\0') { Tcl_SetVar2(interp, "auto_path", NULL, scriptPath, TCL_GLOBAL_ONLY|TCL_LIST_ELEMENT|TCL_APPEND_VALUE); } Tcl_CreateObjCommand(interp, "::tk::mac::standardAboutPanel", TkMacOSXStandardAboutPanelObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "::tk::mac::registerServiceWidget", TkMacOSXRegisterServiceWidgetObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "::tk::mac::iconBitmap", TkMacOSXIconBitmapObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "::tk::mac::GetAppPath", TkMacOSXGetAppPath,(ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); /* * Initialize the NSServices object here. Apple's docs say to do this * in applicationDidFinishLaunching, but the Tcl interpreter is not * initialized until this function call. */ TkMacOSXServices_Init(interp); return TCL_OK; } /* *---------------------------------------------------------------------- * |
︙ | |||
421 422 423 424 425 426 427 | 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 | - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | p = strrchr(name, '/'); if (p != NULL) { name = p+1; } } Tcl_DStringAppend(namePtr, name, -1); } |
︙ |
Changes to macosx/tkMacOSXPrivate.h.
︙ | |||
230 231 232 233 234 235 236 | 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | - + + + + + | MODULE_SCOPE int TkMacOSXStandardAboutPanelObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); MODULE_SCOPE int TkMacOSXIconBitmapObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); MODULE_SCOPE void TkMacOSXDrawSolidBorder(Tk_Window tkwin, GC gc, |
︙ | |||
325 326 327 328 329 330 331 332 333 334 335 336 337 338 | 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | + + | withReplyEvent: (NSAppleEventDescriptor *)replyEvent; - (void) handleOpenDocumentsEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent; - (void) handlePrintDocumentsEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent; - (void) handleDoScriptEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent; - (void)handleURLEvent: (NSAppleEventDescriptor*)event withReplyEvent: (NSAppleEventDescriptor*)replyEvent; @end VISIBILITY_HIDDEN @interface TKContentView : NSView <NSTextInput> { @private NSString *privateWorkingText; |
︙ | |||
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 | + + | */ @interface NSApplication(TKMenu) - (void) setAppleMenu: (NSMenu *) menu; @end #endif /* _TKMACPRIV */ int TkMacOSXGetAppPath(ClientData cd, Tcl_Interp *ip, int objc, Tcl_Obj *CONST objv[]); /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
Added macosx/tkMacOSXServices.c.