summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Walzer <kw@codebykevin.com>2019-05-20 02:33:01 (GMT)
committerKevin Walzer <kw@codebykevin.com>2019-05-20 02:33:01 (GMT)
commitcc1acfaabd6c9e88963ea23d07c5654ad9532818 (patch)
treec82e25f53909d677bd9a15e39d4061676cfdbe42
parent53fd39ddc9ce3ad71ec95bc66101342c70032784 (diff)
downloadtk-cc1acfaabd6c9e88963ea23d07c5654ad9532818.zip
tk-cc1acfaabd6c9e88963ea23d07c5654ad9532818.tar.gz
tk-cc1acfaabd6c9e88963ea23d07c5654ad9532818.tar.bz2
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
-rw-r--r--doc/tk_mac.n5
-rw-r--r--library/tk.tcl9
-rw-r--r--macosx/README74
-rw-r--r--macosx/tkMacOSXServices.c9
4 files changed, 35 insertions, 62 deletions
diff --git a/doc/tk_mac.n b/doc/tk_mac.n
index 8256904..1694385 100644
--- a/doc/tk_mac.n
+++ b/doc/tk_mac.n
@@ -156,9 +156,8 @@ menu in the Application menu item. The
menu item allows for inter-application communication; data from one
application, such as selected text, can be sent to another application
for processing, for example to Safari as a search item for Google, or
-to TextEdit to be appended to a file. Tk includes a stub version of
-this command that displays a dialog with the data sent. This proc
-should be rewritten in an application script for customization:
+to TextEdit to be appended to a file. An example of the proc is below,
+and should be rewritten in an application script for customization:
.RS
.PP
.CS
diff --git a/library/tk.tcl b/library/tk.tcl
index f1e164a..28e9aad 100644
--- a/library/tk.tcl
+++ b/library/tk.tcl
@@ -682,15 +682,6 @@ if {[tk windowingsystem] eq "aqua"} {
namespace eval ::tk::mac {
set useCustomMDEF 0
}
-
- #stub proc for NSServices API, must be replaced with custom implementation
- proc ::tk::mac::PerformService {} {
-
- set data [clipboard get]
-
- tk_messageBox -icon info -title "Services Example" -message "This data was sent to Wish with the NSServices API:\n\n$data"
-
- }
}
#register to send data to macOS Services
diff --git a/macosx/README b/macosx/README
index d7333e8..04073dd 100644
--- a/macosx/README
+++ b/macosx/README
@@ -59,11 +59,6 @@ $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
@@ -87,28 +82,6 @@ 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).
-- TkAqua drawing is antialiased by default, but (outline) linewidth can be used
-to control whether a line/shape is drawn antialiased. The antialiasing threshold
-is 0 by default (i.e. antialias everything), it can be changed by setting
- set tk::mac::CGAntialiasLimit <limit>
-in your script before drawing, in which case lines (or shapes with outlines)
-thinner than <limit> pixels will not be antialiased.
-
-- Text antialiasing by default uses the standard OS antialising settings.
-Setting the global variable '::tk::mac::antialiasedtext' allows to control text
-antialiasing from Tcl: a value of 1 enables AA, 0 disables AA and -1 restores
-the default behaviour of respecting the OS settings.
-
-- Scrollbars: There are two scrollbar variants in Aqua, normal & small. The
-normal scrollbar has a small dimension of 15, the small variant 11.
-Access to the small variant was added in Tk 8.4.2.
-
-- The default metrics of native buttons, radiobuttons, checkboxes and
-menubuttons in the Cocoa-based Tk 8.5.7 and later preserve compatibility with
-the older Carbon-based implementation, you can turn off the compatibility
-metrics to get more native-looking spacing by setting:
- set tk::mac::useCompatibilityMetrics 0
-
- TkAqua provides access to native OS X images via the Tk native bitmap facility
(including any image file readable by NSImage). A native bitmap name is
interpreted as follows (in order):
@@ -336,9 +309,7 @@ corresponding depth.
5. 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.
+- macOS 10.6 is required to build TkAqua and TkX11. 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-select --install
@@ -397,17 +368,6 @@ 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
@@ -712,3 +672,35 @@ 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, but testing and deploying can be a bit tricky. Apple's documents suggest running /System/Library/CoreServices/pbs -dump_pboard to check to see if your application's services have been recognized by the OS, but it may also be necessary to work with Apple's "lsregister" tool to ensure that the correct version of Wish has been picked up by the OS:
+
+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 launch services database used by the launch service like this:
+$ lsregister -kill
+$ lsregister -seed
+
+Then you can run this command to find out what will happen if you ask the launch service to launch Wish.app:
+lsregister -dump | grep path | grep Wish
+
+If the wrong version of Wish is showing up in this list, you can unregister that version as follows:
+
+alias lsregister='/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister'
+
+You can reset the database used by the launch service like this:
+$ lsregister -kill
+$ lsregister -seed
+
+Then you can run this command to find out what will happen if you ask the launch service to launch Wish.app:
+
+lsregister -u /path/to/Wish
+
+Continue this until the correct version of Wish shows up in your path.
+
+This advice is focused mainly on testing the services you are developing for your application. From an end-user standpoint, 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, so the complexities discussed above are not likely to be encountered by end users. \ No newline at end of file
diff --git a/macosx/tkMacOSXServices.c b/macosx/tkMacOSXServices.c
index 39874b7..3a31e6c 100644
--- a/macosx/tkMacOSXServices.c
+++ b/macosx/tkMacOSXServices.c
@@ -161,8 +161,6 @@ int TkMacOSXRegisterServiceWidgetObjCmd (
Tcl_Obj *CONST objv[])
{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
/*
* Need proper number of args.
*/
@@ -210,7 +208,6 @@ int TkMacOSXRegisterServiceWidgetObjCmd (
[serviceview setFrame:frame];
}
[serviceview release];
- [pool release];
return TCL_OK;
}
@@ -221,11 +218,6 @@ int TkMacOSXRegisterServiceWidgetObjCmd (
int TkMacOSXServices_Init(
Tcl_Interp *interp)
{
- /*
- * Set up an autorelease pool.
- */
-
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
/*
* Initialize instance of TclServices to provide service functionality.
@@ -234,7 +226,6 @@ int TkMacOSXServices_Init(
TkService *service = [[TkService alloc] init];
ServicesInterp = interp;
[NSApp setServicesProvider:service];
- [pool drain];
return TCL_OK;
}