diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-11-12 14:52:53 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-11-12 14:52:53 (GMT) |
commit | 304456c27894c1a53b435c99aa10036f018204fd (patch) | |
tree | 45e7f9a1ef59394684c49f4d6506afde0146da6c /macosx | |
parent | e179c5f50a60f4d97b9963fe6ad71e2376886ac4 (diff) | |
parent | bc52b8485678245b43a48cec01756c05b11fc17d (diff) | |
download | tk-304456c27894c1a53b435c99aa10036f018204fd.zip tk-304456c27894c1a53b435c99aa10036f018204fd.tar.gz tk-304456c27894c1a53b435c99aa10036f018204fd.tar.bz2 |
Merge 8.6
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/tkMacOSXConstants.h | 1 | ||||
-rw-r--r-- | macosx/tkMacOSXImage.c | 7 | ||||
-rw-r--r-- | macosx/tkMacOSXSubwindows.c | 33 | ||||
-rw-r--r-- | macosx/tkMacOSXWindowEvent.c | 3 | ||||
-rw-r--r-- | macosx/tkMacOSXWm.c | 2 |
5 files changed, 39 insertions, 7 deletions
diff --git a/macosx/tkMacOSXConstants.h b/macosx/tkMacOSXConstants.h index 8ab6a80..db5c78e 100644 --- a/macosx/tkMacOSXConstants.h +++ b/macosx/tkMacOSXConstants.h @@ -96,6 +96,7 @@ typedef NSInteger NSModalResponse; #define NSMiniaturizableWindowMask NSWindowStyleMaskMiniaturizable #define NSBorderlessWindowMask NSWindowStyleMaskBorderless #define NSFullScreenWindowMask NSWindowStyleMaskFullScreen +#define NSAlphaFirstBitmapFormat NSBitmapFormatAlphaFirst #endif #if MAC_OS_X_VERSION_MIN_REQUIRED >= 101400 diff --git a/macosx/tkMacOSXImage.c b/macosx/tkMacOSXImage.c index 7eadb39..f3d0467 100644 --- a/macosx/tkMacOSXImage.c +++ b/macosx/tkMacOSXImage.c @@ -13,6 +13,7 @@ */ #include "tkMacOSXPrivate.h" +#include "tkMacOSXConstants.h" #include "xbytes.h" static CGImageRef CreateCGImageFromPixmap(Drawable pixmap); @@ -68,7 +69,7 @@ typedef struct RGBA32pixel_t { /* * ARGB32 0xAARRGGBB (Byte order is ARGB on big-endian systems.) * This is used by Aqua Tk for XImages and by NSBitmapImageReps whose - * bitmapFormat property is NSBitmapFormatAlphaFirst. + * bitmapFormat property is NSAlphaFirstBitmapFormat. */ typedef struct ARGB32pixel_t { @@ -760,7 +761,7 @@ XGetImage( size = [bitmapRep bytesPerPlane]; bytes_per_row = [bitmapRep bytesPerRow]; bitmap = (char *)ckalloc(size); - if ((bitmap_fmt != 0 && bitmap_fmt != NSBitmapFormatAlphaFirst) + if ((bitmap_fmt != 0 && bitmap_fmt != NSAlphaFirstBitmapFormat) || [bitmapRep samplesPerPixel] != 4 || [bitmapRep isPlanar] != 0 || bytes_per_row < 4 * width @@ -787,7 +788,7 @@ XGetImage( flipped.rgba.blue = pixel.argb.blue; flipped.rgba.alpha = pixel.argb.alpha; *((pixel32 *)(bitmap + m)) = flipped; - } else { // bitmap_fmt = NSBitmapFormatAlphaFirst + } else { // bitmap_fmt = NSAlphaFirstBitmapFormat *((pixel32 *)(bitmap + m)) = pixel; } } diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c index 21e346a..6fd2b21 100644 --- a/macosx/tkMacOSXSubwindows.c +++ b/macosx/tkMacOSXSubwindows.c @@ -303,12 +303,41 @@ XUnmapWindow( display->request++; if (Tk_IsTopLevel(winPtr)) { if (!Tk_IsEmbedded(winPtr) && - winPtr->wmInfoPtr->hints.initial_state!=IconicState) { - [win orderOut:nil]; + winPtr->wmInfoPtr->hints.initial_state!=IconicState) { [win setExcludedFromWindowsMenu:YES]; + [win orderOut:NSApp]; + if ([win isKeyWindow]) { + + /* + * If we are unmapping the key window then we need to make sure + * that a new key window is assigned, if possible. This is + * supposed to happen when a key window is ordered out, but as + * noted in tkMacOSXWm.c this does not happen, in spite of + * Apple's claims to the contrary. + */ + + for (NSWindow *w in [NSApp orderedWindows]) { + TkWindow *winPtr2 = TkMacOSXGetTkWindow(w); + WmInfo *wmInfoPtr; + + BOOL isOnScreen; + + if (!winPtr2 || !winPtr2->wmInfoPtr) { + continue; + } + wmInfoPtr = winPtr2->wmInfoPtr; + isOnScreen = (wmInfoPtr->hints.initial_state != IconicState && + wmInfoPtr->hints.initial_state != WithdrawnState); + if (w != win && isOnScreen && [w canBecomeKeyWindow]) { + [w makeKeyAndOrderFront:NSApp]; + break; + } + } + } } TkMacOSXInvalClipRgns((Tk_Window)winPtr); } else { + /* * Rebuild the visRgn clip region for the parent so it will be allowed * to draw in the space from which this subwindow was removed and then diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index dc58740..d8986c0 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -188,6 +188,7 @@ extern NSString *NSWindowDidOrderOffScreenNotification; TkWindow *winPtr = TkMacOSXGetTkWindow(w); if (winPtr) { + winPtr->wmInfoPtr->hints.initial_state = IconicState; Tk_UnmapWindow((Tk_Window)winPtr); } } @@ -336,7 +337,7 @@ static void RefocusGrabWindow(void *data) { continue; } if (winPtr->wmInfoPtr->hints.initial_state == WithdrawnState) { - [win orderOut:nil]; + [win orderOut:NSApp]; } if (winPtr->dispPtr->grabWinPtr == winPtr) { Tcl_DoWhenIdle(RefocusGrabWindow, winPtr); diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 69d9e70..b081c4a 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -2900,7 +2900,7 @@ WmIconwindowCmd( */ TkpWmSetState(oldIcon, WithdrawnState); - [win orderOut:nil]; + [win orderOut:NSApp]; [win setExcludedFromWindowsMenu:YES]; wmPtr3->iconFor = NULL; } |