diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-08 11:02:00 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-08 11:02:00 (GMT) |
commit | 2c80218636b778e62c7c0707c891553b83a79a26 (patch) | |
tree | 50cad0b3dcb10641fde14caaf2993123a9dc5991 /macosx | |
parent | d3271e2d220f2768f99b11887816cacb6223c784 (diff) | |
download | tk-2c80218636b778e62c7c0707c891553b83a79a26.zip tk-2c80218636b778e62c7c0707c891553b83a79a26.tar.gz tk-2c80218636b778e62c7c0707c891553b83a79a26.tar.bz2 |
Move up TkUnusedStubEntry a little.
New test function "menubarheight" for MacOSX (backported from 8.6)
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/tkMacOSXTest.c | 65 | ||||
-rw-r--r-- | macosx/tkMacOSXXStubs.c | 2 |
2 files changed, 55 insertions, 12 deletions
diff --git a/macosx/tkMacOSXTest.c b/macosx/tkMacOSXTest.c index 0e43785..a8ae788 100644 --- a/macosx/tkMacOSXTest.c +++ b/macosx/tkMacOSXTest.c @@ -13,14 +13,20 @@ */ #include "tkMacOSXPrivate.h" +#include "tkMacOSXWm.h" + /* * Forward declarations of procedures defined later in this file: */ -static int DebuggerCmd (ClientData dummy, Tcl_Interp *interp, - int argc, const char **argv); -MODULE_SCOPE int TkplatformtestInit(Tcl_Interp *interp); +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1080 +static int DebuggerObjCmd(ClientData dummy, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]); +#endif +static int MenuBarHeightObjCmd(ClientData dummy, Tcl_Interp *interp, + int objc, Tcl_Obj *const *objv); + /* *---------------------------------------------------------------------- @@ -47,18 +53,20 @@ TkplatformtestInit( * Add commands for platform specific tests on MacOS here. */ - Tcl_CreateCommand(interp, "debugger", DebuggerCmd, - (ClientData) 0, (Tcl_CmdDeleteProc *) NULL); - +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1080 + Tcl_CreateObjCommand(interp, "debugger", DebuggerObjCmd, NULL, NULL); +#endif + Tcl_CreateObjCommand(interp, "menubarheight", MenuBarHeightObjCmd, NULL, NULL); return TCL_OK; } /* *---------------------------------------------------------------------- * - * DebuggerCmd -- + * DebuggerObjCmd -- * - * This procedure simply calls the low level debugger. + * This procedure simply calls the low level debugger, which was + * deprecated in OSX 10.8. * * Results: * A standard Tcl result. @@ -69,16 +77,51 @@ TkplatformtestInit( *---------------------------------------------------------------------- */ +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1080 static int -DebuggerCmd( +DebuggerObjCmd( ClientData clientData, /* Not used. */ Tcl_Interp *interp, /* Not used. */ - int argc, /* Not used. */ - const char **argv) /* Not used. */ + int objc, /* Not used. */ + Tcl_Obj *const objv[]) /* Not used. */ { Debugger(); return TCL_OK; } +#endif + +/* + *---------------------------------------------------------------------- + * + * MenuBarHeightObjCmd -- + * + * This procedure calls [NSMenu menuBarHeight] and returns the result + * as an integer. Windows can never be placed to overlap the MenuBar, + * so tests need to be aware of its size. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static int +MenuBarHeightObjCmd( + ClientData clientData, /* Not used. */ + Tcl_Interp *interp, /* Not used. */ + int objc, /* Not used. */ + Tcl_Obj *const objv[]) /* Not used. */ +{ + static int height = 0; + if (height == 0) { + height = (int) [[NSApp mainMenu] menuBarHeight]; + } + Tcl_SetObjResult(interp, Tcl_NewIntObj(height)); + return TCL_OK; +} /* * Local Variables: diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c index a541945..b6b1659 100644 --- a/macosx/tkMacOSXXStubs.c +++ b/macosx/tkMacOSXXStubs.c @@ -719,7 +719,7 @@ Tk_FreeXId( int XSync( Display *display, - Bool flag) + Bool discard) { TkMacOSXFlushWindows(); display->request++; |