Tk Source Code

Check-in [84303091b1]
Login

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

Overview
Comment:Fix [1356961b8c]: wm-transient-1.8 fails on macOS. Patch from Marc Culler.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-6-branch
Files: files | file ages | folders
SHA3-256:84303091b1766e11e5c44c25ecc3c284c2b74ad38479ca682b1ccaca051b49a3
User & Date: fvogel 2018-07-04 08:40:13
Context
2018-07-04
08:43
Fix [37a723eadd]: wm-transient-2.2 fails on macOS check-in: cc96f015bf user: fvogel tags: core-8-6-branch
08:40
Fix [1356961b8c]: wm-transient-1.8 fails on macOS. Patch from Marc Culler. check-in: 212967b6c4 user: fvogel tags: trunk
08:40
Fix [1356961b8c]: wm-transient-1.8 fails on macOS. Patch from Marc Culler. check-in: 84303091b1 user: fvogel tags: core-8-6-branch
07:12
Fix [6ca257310a]: wm resizable does not disable single dimension resizing on macOS. Patch from Marc Culler. check-in: 155ec67d85 user: fvogel tags: core-8-6-branch
2018-06-30
21:08
Fix bug [1356961b8c]: add code to ensure wm transient is using a true toplevel as the master. Closed-Leaf check-in: ba4117fa44 user: culler tags: bug-1356961b8c
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to macosx/tkMacOSXWm.c.

3439
3440
3441
3442
3443
3444
3445








3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
	    ckfree(wmPtr->masterWindowName);
	}
	wmPtr->masterWindowName = NULL;
    } else {
	if (TkGetWindowFromObj(interp, tkwin, objv[3], &master) != TCL_OK) {
	    return TCL_ERROR;
	}








	Tk_MakeWindowExist(master);

	if (wmPtr->iconFor != NULL) {
	    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
		    "can't make \"%s\" a transient: it is an icon for %s",
		    Tcl_GetString(objv[2]), Tk_PathName(wmPtr->iconFor)));
	    Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "ICON", NULL);
	    return TCL_ERROR;
	}

	wmPtr2 = ((TkWindow *) master)->wmInfoPtr;

	/* Under some circumstances, wmPtr2 is NULL here */
	if (wmPtr2 != NULL && wmPtr2->iconFor != NULL) {
	    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
		    "can't make \"%s\" a master: it is an icon for %s",
		    Tcl_GetString(objv[3]), Tk_PathName(wmPtr2->iconFor)));
	    Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "ICON", NULL);
	    return TCL_ERROR;
	}

	if ((TkWindow *) master == winPtr) {
	    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
		    "can't make \"%s\" its own master", Tk_PathName(winPtr)));
	    Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "SELF", NULL);
	    return TCL_ERROR;
	}

	wmPtr->master = Tk_WindowId(master);
	masterWindowName = Tcl_GetStringFromObj(objv[3], &length);
	if (wmPtr->masterWindowName != NULL) {
	    ckfree(wmPtr->masterWindowName);
	}
	wmPtr->masterWindowName = ckalloc(length+1);
	strcpy(wmPtr->masterWindowName, masterWindowName);
    }







>
>
>
>
>
>
>
>
|









|
<









|






|







3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464

3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
	    ckfree(wmPtr->masterWindowName);
	}
	wmPtr->masterWindowName = NULL;
    } else {
	if (TkGetWindowFromObj(interp, tkwin, objv[3], &master) != TCL_OK) {
	    return TCL_ERROR;
	}
	TkWindow* masterPtr = (TkWindow*) master;
	while (!Tk_TopWinHierarchy(masterPtr)) {
            /*
             * Ensure that the master window is actually a Tk toplevel.
             */

            masterPtr = masterPtr->parentPtr;
        }
	Tk_MakeWindowExist((Tk_Window)masterPtr);

	if (wmPtr->iconFor != NULL) {
	    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
		    "can't make \"%s\" a transient: it is an icon for %s",
		    Tcl_GetString(objv[2]), Tk_PathName(wmPtr->iconFor)));
	    Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "ICON", NULL);
	    return TCL_ERROR;
	}

	wmPtr2 = masterPtr->wmInfoPtr;

	/* Under some circumstances, wmPtr2 is NULL here */
	if (wmPtr2 != NULL && wmPtr2->iconFor != NULL) {
	    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
		    "can't make \"%s\" a master: it is an icon for %s",
		    Tcl_GetString(objv[3]), Tk_PathName(wmPtr2->iconFor)));
	    Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "ICON", NULL);
	    return TCL_ERROR;
	}

	if (masterPtr == winPtr) {
	    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
		    "can't make \"%s\" its own master", Tk_PathName(winPtr)));
	    Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "SELF", NULL);
	    return TCL_ERROR;
	}

	wmPtr->master = Tk_WindowId(masterPtr);
	masterWindowName = Tcl_GetStringFromObj(objv[3], &length);
	if (wmPtr->masterWindowName != NULL) {
	    ckfree(wmPtr->masterWindowName);
	}
	wmPtr->masterWindowName = ckalloc(length+1);
	strcpy(wmPtr->masterWindowName, masterWindowName);
    }