diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2019-10-28 19:24:37 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2019-10-28 19:24:37 (GMT) |
commit | 032c885d84db5a327e8277e09a4eb40945677d6c (patch) | |
tree | 8758c7f1890f526273c1ffc5c224e13f8c4a75dd /tkmacosx | |
parent | cd12224eb582114a6ab836369a1c6b9931211c37 (diff) | |
download | blt-032c885d84db5a327e8277e09a4eb40945677d6c.zip blt-032c885d84db5a327e8277e09a4eb40945677d6c.tar.gz blt-032c885d84db5a327e8277e09a4eb40945677d6c.tar.bz2 |
SAVEIMAGE/CAT fixed a problem with MacOS support
Diffstat (limited to 'tkmacosx')
-rw-r--r-- | tkmacosx/tkmacosx.M | 28 | ||||
-rw-r--r-- | tkmacosx/tkmacosx.h | 1 |
2 files changed, 27 insertions, 2 deletions
diff --git a/tkmacosx/tkmacosx.M b/tkmacosx/tkmacosx.M index 585d33d..30b8108 100644 --- a/tkmacosx/tkmacosx.M +++ b/tkmacosx/tkmacosx.M @@ -26,7 +26,7 @@ int Tkmacosx_Init(Tcl_Interp* interp) { if (Tk_InitStubs(interp, TK_PATCH_LEVEL, 0) == NULL) return TCL_ERROR; - Tcl_CreateCommand(interp, "macosx", TkmacosxCmd, + Tcl_CreateCommand(interp, "macos", TkmacosxCmd, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); if (Tcl_PkgProvide(interp, PACKAGE_NAME, PACKAGE_VERSION)) @@ -42,6 +42,8 @@ int TkmacosxCmd(ClientData data,Tcl_Interp *interp,int argc,const char* argv[]) if (argc>=2) { if (!strncmp(argv[1], "pm", 2)) return tkmacosx->pm(argc, argv); + else if (!strncmp(argv[1], "sc", 2)) + return tkmacosx->sc(argc, argv); else if (!strncmp(argv[1], "locale", 2)) return tkmacosx->locale(argc, argv); else { @@ -130,6 +132,28 @@ int TkMacosx::pm(int argc, const char* argv[]) return TCL_OK; } +// major kludge, located in hacked tk8.6/macosx/tkMacOSXDraw.c +extern int enableScreenCapture; +int TkMacosx::sc(int argc, const char* argv[]) +{ + if (argc >= 1) { + if (!strncmp(argv[2], "yes", 3)) { + enableScreenCapture =1; + return TCL_OK; + } + else if (!strncmp(argv[2], "no", 2)) { + enableScreenCapture =0; + return TCL_OK; + } + else { + Tcl_AppendResult(interp, "tkmacosx sc: unknown command: ", argv[2], NULL); + return TCL_ERROR; + } + } + Tcl_AppendResult(interp, "usage: tkmacosx sc yes|no", NULL); + return TCL_ERROR; +} + int TkMacosx::pmPrint(int argc, const char* argv[]) { if (argc >= 4) { @@ -180,7 +204,7 @@ int TkMacosx::pmPrintBegin(int argc, const char* argv[]) NSPrintOperation* printOp = \ [NSPrintOperation printOperationWithView:pmView printInfo:printInfo]; // [printOp setCanSpawnSeparateThread:YES]; - NSGraphicsContext* context = [printOp createContext]; + // NSGraphicsContext* context = [printOp createContext]; [printOp runOperation]; return TCL_OK; diff --git a/tkmacosx/tkmacosx.h b/tkmacosx/tkmacosx.h index 9363750..d31e408 100644 --- a/tkmacosx/tkmacosx.h +++ b/tkmacosx/tkmacosx.h @@ -46,6 +46,7 @@ class TkMacosx { ~TkMacosx(); int pm(int, const char**); + int sc(int, const char**); int locale(int, const char**); const Matrix& getCanvasToPage() {return canvasToPage;} |