diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-11-30 20:54:37 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-11-30 20:54:37 (GMT) |
commit | 682e78d50eff346d5f0d3914c3913c6cb0c92c5a (patch) | |
tree | 0d6fa67a20f44bbbcd9b3aa41c603ed38b6e1654 /macosx/tkMacOSXInit.c | |
parent | 3f351dd65a460eed8c85334493d901b90275ffc5 (diff) | |
parent | 4138204f761f61153be0a1bab6a1fe917029eaf9 (diff) | |
download | tk-682e78d50eff346d5f0d3914c3913c6cb0c92c5a.zip tk-682e78d50eff346d5f0d3914c3913c6cb0c92c5a.tar.gz tk-682e78d50eff346d5f0d3914c3913c6cb0c92c5a.tar.bz2 |
Merge 8.7
Diffstat (limited to 'macosx/tkMacOSXInit.c')
-rw-r--r-- | macosx/tkMacOSXInit.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c index a1de785..375d20e 100644 --- a/macosx/tkMacOSXInit.c +++ b/macosx/tkMacOSXInit.c @@ -14,9 +14,11 @@ */ #include "tkMacOSXPrivate.h" +#include "tkMacOSXConstants.h" #include <dlfcn.h> #include <objc/objc-auto.h> #include <sys/stat.h> +#include <sys/utsname.h> static char tkLibPath[PATH_MAX + 1] = ""; @@ -43,6 +45,10 @@ static int TkMacOSVersionObjCmd(ClientData cd, Tcl_Interp *ip, @synthesize macOSVersion = _macOSVersion; @synthesize isDrawing = _isDrawing; @synthesize isSigned = _isSigned; +@synthesize tkLiveResizeEnded = _tkLiveResizeEnded; +@synthesize tkPointerWindow = _tkPointerWindow; +@synthesize tkEventTarget = _tkEventTarget; +@synthesize tkButtonState = _tkButtonState; @end /* @@ -170,6 +176,20 @@ static int TkMacOSVersionObjCmd(ClientData cd, Tcl_Interp *ip, [NSApp activateIgnoringOtherApps: YES]; /* + * Add an event monitor so we continue to receive NSMouseMoved and + * NSMouseDragged events when the mouse moves outside of the key + * window. The handler simply returns the events it receives, so + * they can be processed in the same way as for other events. + */ + + [NSEvent addLocalMonitorForEventsMatchingMask:(NSMouseMovedMask | + NSLeftMouseDraggedMask) + handler:^NSEvent *(NSEvent *event) + { + return event; + }]; + + /* * Process events to ensure that the root window is fully initialized. See * ticket 56a1823c73. */ @@ -197,6 +217,7 @@ static int TkMacOSVersionObjCmd(ClientData cd, Tcl_Interp *ip, */ int minorVersion, majorVersion; + #if MAC_OS_X_VERSION_MAX_ALLOWED < 101000 Gestalt(gestaltSystemVersionMinor, (SInt32*)&minorVersion); majorVersion = 10; @@ -206,6 +227,24 @@ static int TkMacOSVersionObjCmd(ClientData cd, Tcl_Interp *ip, majorVersion = systemVersion.majorVersion; minorVersion = systemVersion.minorVersion; #endif + + if (majorVersion == 10 && minorVersion == 16) { + + /* + * If a program compiled with a macOS 10.XX SDK is run on macOS 11.0 or + * later then it will report majorVersion 10 and minorVersion 16, no + * matter what the actual OS version of the host may be. And of course + * Apple never released macOS 10.16. To work around this we guess the + * OS version from the kernel release number, as reported by uname. + */ + + struct utsname name; + char *endptr; + if (uname(&name) == 0) { + majorVersion = strtol(name.release, &endptr, 10) - 9; + minorVersion = 0; + } + } [NSApp setMacOSVersion: 10000*majorVersion + 100*minorVersion]; /* |