Tk Source Code

Check-in [136f483d]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Revised fix for [07cfc9f03e]: Aqua: Non-menubar menu invisible if toplevel is on another display. Already applied to Tk 9.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | core-8-6-branch
Files: files | file ages | folders
SHA3-256: 136f483de9c3699d49fe85f8518f11076434ff4756dfa4dfb2b2da7ad4b3e035
User & Date: chrstphrchvz 2025-08-14 20:53:41.621
Context
2025-08-15
19:16
Merge release check-in: 74b1a05f user: dgp tags: core-8-6-branch
2025-08-14
20:53
Revised fix for [07cfc9f03e]: Aqua: Non-menubar menu invisible if toplevel is on another display. Already applied to Tk 9. check-in: 136f483d user: chrstphrchvz tags: core-8-6-branch
2025-08-12
10:55
actions/checkout@v4 -> actions/checkout@v5 check-in: 5766e011 user: jan.nijtmans tags: core-8-6-branch
Changes
Unified Diff Ignore Whitespace Patch
Changes to macosx/tkMacOSXMenu.c.
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
	realWinPtr = (TkWindow*) realWin;
	realWinView = TkMacOSXGetNSViewForDrawable(realWinPtr->privatePtr);
	if (realWinView != nil) {
	    break;
	}
	realWin = Tk_Parent(realWin);
    }
    NSWindow *win = [realWinView window];
    NSView *view = [win contentView];
    NSMenu *menu = (NSMenu *) menuPtr->platformData;
    NSInteger itemIndex = index;
    NSInteger numItems = [menu numberOfItems];
    NSMenuItem *item = nil;
    NSPoint location = NSMakePoint(x, TkMacOSXZeroScreenHeight() - y);

    inPostMenu = true;







<
<







951
952
953
954
955
956
957


958
959
960
961
962
963
964
	realWinPtr = (TkWindow*) realWin;
	realWinView = TkMacOSXGetNSViewForDrawable(realWinPtr->privatePtr);
	if (realWinView != nil) {
	    break;
	}
	realWin = Tk_Parent(realWin);
    }


    NSMenu *menu = (NSMenu *) menuPtr->platformData;
    NSInteger itemIndex = index;
    NSInteger numItems = [menu numberOfItems];
    NSMenuItem *item = nil;
    NSPoint location = NSMakePoint(x, TkMacOSXZeroScreenHeight() - y);

    inPostMenu = true;
982
983
984
985
986
987
988
989
990

991
992
993
994
995
996
997
     */

    if (menuPtr->tkwin == NULL) {
    	return TCL_OK;
    }

    [menu popUpMenuPositioningItem:item
			atLocation:[win tkConvertPointFromScreen:location]
			    inView:view];

    inPostMenu = false;
    return TCL_OK;
}

/*
 *----------------------------------------------------------------------
 *







|
|
>







980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
     */

    if (menuPtr->tkwin == NULL) {
    	return TCL_OK;
    }

    [menu popUpMenuPositioningItem:item
			atLocation:location
			    inView:nil
			appearance:realWinView.effectiveAppearance];
    inPostMenu = false;
    return TCL_OK;
}

/*
 *----------------------------------------------------------------------
 *
Changes to macosx/tkMacOSXPrivate.h.
483
484
485
486
487
488
489








490
491
492
493
494
495
496
@interface NSMenu(TKUtils)
+ (id)menuWithTitle:(NSString *)title;
+ (id)menuWithTitle:(NSString *)title menuItems:(NSArray *)items;
+ (id)menuWithTitle:(NSString *)title submenus:(NSArray *)submenus;
- (NSMenuItem *)itemWithSubmenu:(NSMenu *)submenu;
- (NSMenuItem *)itemInSupermenu;
@end









@interface NSMenuItem(TKUtils)
+ (id)itemWithSubmenu:(NSMenu *)submenu;
+ (id)itemWithTitle:(NSString *)title submenu:(NSMenu *)submenu;
+ (id)itemWithTitle:(NSString *)title action:(SEL)action;
+ (id)itemWithTitle:(NSString *)title action:(SEL)action
	target:(id)target;







>
>
>
>
>
>
>
>







483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
@interface NSMenu(TKUtils)
+ (id)menuWithTitle:(NSString *)title;
+ (id)menuWithTitle:(NSString *)title menuItems:(NSArray *)items;
+ (id)menuWithTitle:(NSString *)title submenus:(NSArray *)submenus;
- (NSMenuItem *)itemWithSubmenu:(NSMenu *)submenu;
- (NSMenuItem *)itemInSupermenu;
@end

// Need undocumented appearance: argument
@interface NSMenu(TKMenu)
- (BOOL)popUpMenuPositioningItem:(NSMenuItem *)item
		      atLocation:(NSPoint)location
			  inView:(NSView *)view
		      appearance:(NSAppearance *)appearance;
@end

@interface NSMenuItem(TKUtils)
+ (id)itemWithSubmenu:(NSMenu *)submenu;
+ (id)itemWithTitle:(NSString *)title submenu:(NSMenu *)submenu;
+ (id)itemWithTitle:(NSString *)title action:(SEL)action;
+ (id)itemWithTitle:(NSString *)title action:(SEL)action
	target:(id)target;