Tk Source Code

Check-in [14b2a46f]
Login

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

Overview
Comment:Fix bug[bf93d098d7]: Menubar is sometimes unresponsive on app startup
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | bug-bf93d098d7
Files: files | file ages | folders
SHA3-256: 14b2a46ffe1d17248d188f2f6e7b47783836f0ad206a9c30dfae73849ed94822
User & Date: culler 2019-10-11 02:52:02
Context
2019-10-20
03:40
Partial fix for [bf93d098d7]: On macOS Catalina menus can be unresponsive at app startup. check-in: ab497177 user: culler tags: core-8-6-branch
2019-10-11
16:57
macOS: avoid periodic events exception when holding green zoom button. Closed-Leaf check-in: fc657008 user: culler tags: mistake
02:52
Fix bug[bf93d098d7]: Menubar is sometimes unresponsive on app startup Closed-Leaf check-in: 14b2a46f user: culler tags: bug-bf93d098d7
2019-10-10
23:07
Merge the remainder of catalina_more_tests check-in: c606fe29 user: culler tags: core-8-6-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to macosx/tkMacOSXInit.c.

112
113
114
115
116
117
118
119
120
121
122






123
124

125
126
127
128
129
130
131
     */
    TkMacOSXUseAntialiasedText(_eventInterp, -1);
    TkMacOSXInitCGDrawing(_eventInterp, TRUE, 0);
}

-(void)applicationDidFinishLaunching:(NSNotification *)notification
{

    /*
     * It is not safe to force activation of the NSApp until this method is
     * called. Activating too early can cause the menu bar to be unresponsive.






     */


    [NSApp activateIgnoringOtherApps: YES];

    /*
     * Process events to ensure that the root window is fully initialized. See
     * ticket 56a1823c73.
     */








<



>
>
>
>
>
>


>







112
113
114
115
116
117
118

119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
     */
    TkMacOSXUseAntialiasedText(_eventInterp, -1);
    TkMacOSXInitCGDrawing(_eventInterp, TRUE, 0);
}

-(void)applicationDidFinishLaunching:(NSNotification *)notification
{

    /*
     * It is not safe to force activation of the NSApp until this method is
     * called. Activating too early can cause the menu bar to be unresponsive.
     * The call to activateIgnoringOtherApps was moved here to avoid this.
     * However, with the release of macOS 10.15 (Catalina) this was no longer
     * sufficient.  (See ticket bf93d098d7.)  Apparently apps were being
     * activated automatically, and this was sometimes being done too early.
     * As a workaround we deactivate and then reactivate the app, even though
     * Apple says that "Normally, you shouldn’t invoke this method".
     */

    [NSApp deactivate];
    [NSApp activateIgnoringOtherApps: YES];

    /*
     * Process events to ensure that the root window is fully initialized. See
     * ticket 56a1823c73.
     */

178
179
180
181
182
183
184

185
186
187
188
189
190
191

    [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];

    /*
     * If no icon has been set from an Info.plist file, use the Wish icon from
     * the Tk framework.
     */

    NSString *iconFile = [[NSBundle mainBundle] objectForInfoDictionaryKey:
						    @"CFBundleIconFile"];
    if (!iconFile) {
	NSString *path = [NSApp tkFrameworkImagePath:@"Tk.icns"];
	if (path) {
	    NSImage *image = [[NSImage alloc] initWithContentsOfFile:path];
	    if (image) {







>







184
185
186
187
188
189
190
191
192
193
194
195
196
197
198

    [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];

    /*
     * If no icon has been set from an Info.plist file, use the Wish icon from
     * the Tk framework.
     */

    NSString *iconFile = [[NSBundle mainBundle] objectForInfoDictionaryKey:
						    @"CFBundleIconFile"];
    if (!iconFile) {
	NSString *path = [NSApp tkFrameworkImagePath:@"Tk.icns"];
	if (path) {
	    NSImage *image = [[NSImage alloc] initWithContentsOfFile:path];
	    if (image) {
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
		}
	    }
	    if (Tk_CreateConsoleWindow(interp) == TCL_ERROR) {
		return TCL_ERROR;
	    }
	}


	/*
	 * Initialize the NSServices object here. Apple's docs say to do this
	 * in applicationDidFinishLaunching, but the Tcl interpreter is not
	 * initialized until this function call.  Only the main interpreter
	 * is allowed to provide services.
	 */

	TkMacOSXServices_Init(interp);

    }

    if (tkLibPath[0] != '\0') {
	Tcl_SetVar2(interp, "tk_library", NULL, tkLibPath, TCL_GLOBAL_ONLY);
    }

    if (scriptPath[0] != '\0') {







<








<







399
400
401
402
403
404
405

406
407
408
409
410
411
412
413

414
415
416
417
418
419
420
		}
	    }
	    if (Tk_CreateConsoleWindow(interp) == TCL_ERROR) {
		return TCL_ERROR;
	    }
	}


	/*
	 * Initialize the NSServices object here. Apple's docs say to do this
	 * in applicationDidFinishLaunching, but the Tcl interpreter is not
	 * initialized until this function call.  Only the main interpreter
	 * is allowed to provide services.
	 */

	TkMacOSXServices_Init(interp);

    }

    if (tkLibPath[0] != '\0') {
	Tcl_SetVar2(interp, "tk_library", NULL, tkLibPath, TCL_GLOBAL_ONLY);
    }

    if (scriptPath[0] != '\0') {