diff options
author | culler <culler> | 2020-07-20 17:59:17 (GMT) |
---|---|---|
committer | culler <culler> | 2020-07-20 17:59:17 (GMT) |
commit | 9f9a5351c3ed97e4a2427e388456f715b95134cd (patch) | |
tree | 7ed893f9a238ed7f8fccdd3b3f9ac5872b840417 /macosx/tkMacOSXTest.c | |
parent | 548ba29c1738582ff39f1835e715cc933b8bfd20 (diff) | |
download | tk-9f9a5351c3ed97e4a2427e388456f715b95134cd.zip tk-9f9a5351c3ed97e4a2427e388456f715b95134cd.tar.gz tk-9f9a5351c3ed97e4a2427e388456f715b95134cd.tar.bz2 |
For macOS tests, account for the fact that Big Sur has a larger menubar.
Diffstat (limited to 'macosx/tkMacOSXTest.c')
-rw-r--r-- | macosx/tkMacOSXTest.c | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/macosx/tkMacOSXTest.c b/macosx/tkMacOSXTest.c index 39f50e6..0a6f4e8 100644 --- a/macosx/tkMacOSXTest.c +++ b/macosx/tkMacOSXTest.c @@ -29,6 +29,8 @@ static int PressButtonObjCmd (ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int InjectKeyEventObjCmd (ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +static int MenuBarHeightObjCmd (ClientData dummy, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]); /* @@ -61,7 +63,7 @@ TkplatformtestInit( #endif Tcl_CreateObjCommand(interp, "pressbutton", PressButtonObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "injectkeyevent", InjectKeyEventObjCmd, NULL, NULL); - + Tcl_CreateObjCommand(interp, "menubarheight", MenuBarHeightObjCmd, NULL, NULL); return TCL_OK; } @@ -98,6 +100,39 @@ DebuggerObjCmd( /* *---------------------------------------------------------------------- * + * 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; +} + +/* + *---------------------------------------------------------------------- + * * TkTestLogDisplay -- * * The test image display procedure calls this to determine whether it |