Tk Source Code

Check-in [d583ba59]
Login

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

Overview
Comment:Fix bug [b389dfcd8f]: Aqua miscalculates window position on secondary display
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | bug-b389dfcd8f
Files: files | file ages | folders
SHA3-256: d583ba595e6741989ca824df5185a8a68c2d505878694de42916ec76352c3a5c
User & Date: culler 2019-02-13 03:34:15
Original Comment: Fix bug [b389dfcd8f]: Aqua window manager miscalculates window position on secondary display
Context
2019-02-13
12:43
Fix bug [b389dfcd8f]: Aqua miscalculates window position on secondary display. check-in: a7bafc45 user: culler tags: core-8-6-branch
03:34
Fix bug [b389dfcd8f]: Aqua miscalculates window position on secondary display Closed-Leaf check-in: d583ba59 user: culler tags: bug-b389dfcd8f
2019-02-10
18:24
Fix bug [8814bddf5d]: segfault in [NSMenu size] check-in: af7dbf1d user: culler tags: core-8-6-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to macosx/tkMacOSXWindowEvent.c.

71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
			 isEqualToString:NSWindowDidMoveNotification];
    NSWindow *w = [notification object];
    TkWindow *winPtr = TkMacOSXGetTkWindow(w);

    if (winPtr) {
	WmInfo *wmPtr = winPtr->wmInfoPtr;
	NSRect bounds = [w frame];
	NSRect screenRect = [[w screen] frame];
	int x, y, width = -1, height = -1, flags = 0;
	int minY = 1 + [[NSApp mainMenu] menuBarHeight];

	x = bounds.origin.x;
	y = screenRect.size.height - (bounds.origin.y + bounds.size.height);
	if (winPtr->changes.x != x || winPtr->changes.y != y) {
	    flags |= TK_LOCATION_CHANGED;
	} else {
	    x = y = -1;
	}
	if (!movedOnly && (winPtr->changes.width != bounds.size.width ||
		winPtr->changes.height !=  bounds.size.height)) {







<




|







71
72
73
74
75
76
77

78
79
80
81
82
83
84
85
86
87
88
89
			 isEqualToString:NSWindowDidMoveNotification];
    NSWindow *w = [notification object];
    TkWindow *winPtr = TkMacOSXGetTkWindow(w);

    if (winPtr) {
	WmInfo *wmPtr = winPtr->wmInfoPtr;
	NSRect bounds = [w frame];

	int x, y, width = -1, height = -1, flags = 0;
	int minY = 1 + [[NSApp mainMenu] menuBarHeight];

	x = bounds.origin.x;
	y = tkMacOSXZeroScreenHeight - (bounds.origin.y + bounds.size.height);
	if (winPtr->changes.x != x || winPtr->changes.y != y) {
	    flags |= TK_LOCATION_CHANGED;
	} else {
	    x = y = -1;
	}
	if (!movedOnly && (winPtr->changes.width != bounds.size.width ||
		winPtr->changes.height !=  bounds.size.height)) {
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
	     * Propagate geometry changes immediately.
	     */

	    flags |= TK_MACOSX_HANDLE_EVENT_IMMEDIATELY;
	}

	/*
	 * Mac windows cannot go higher than the bottom of the menu bar.  The
	 * Tk window manager can request that a window be drawn so that it
	 * overlaps the menu bar, but it will actually be drawn immediately
	 * below the menu bar. In such a case it saves a lot of trouble and
	 * causes no harm if we let Tk think that the window is located at the
	 * requested point. (Many of the the tests assume that this is the
	 * case, especially for windows with upper left corner at (0,0).)  So
	 * we just tell a harmless white lie here.







|







97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
	     * Propagate geometry changes immediately.
	     */

	    flags |= TK_MACOSX_HANDLE_EVENT_IMMEDIATELY;
	}

	/*
	 * Mac windows are not allowed to overlap the menu bar.  The
	 * Tk window manager can request that a window be drawn so that it
	 * overlaps the menu bar, but it will actually be drawn immediately
	 * below the menu bar. In such a case it saves a lot of trouble and
	 * causes no harm if we let Tk think that the window is located at the
	 * requested point. (Many of the the tests assume that this is the
	 * case, especially for windows with upper left corner at (0,0).)  So
	 * we just tell a harmless white lie here.
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
     */

    if (Tk_IsTopLevel(winPtr)) {
	wmPtr = winPtr->wmInfoPtr;
	if (flags & TK_LOCATION_CHANGED) {
	    wmPtr->x = x;
	    wmPtr->y = y;
	    //wmPtr->flags &= ~(WM_NEGATIVE_X | WM_NEGATIVE_Y);
	}
	if ((flags & TK_SIZE_CHANGED) && !(wmPtr->flags & WM_SYNC_PENDING) &&
		((width != Tk_Width(tkwin)) || (height != Tk_Height(tkwin)))) {
	    if ((wmPtr->width == -1) && (width == winPtr->reqWidth)) {

		/*
		 * Don't set external width, since the user didn't change it







<







677
678
679
680
681
682
683

684
685
686
687
688
689
690
     */

    if (Tk_IsTopLevel(winPtr)) {
	wmPtr = winPtr->wmInfoPtr;
	if (flags & TK_LOCATION_CHANGED) {
	    wmPtr->x = x;
	    wmPtr->y = y;

	}
	if ((flags & TK_SIZE_CHANGED) && !(wmPtr->flags & WM_SYNC_PENDING) &&
		((width != Tk_Width(tkwin)) || (height != Tk_Height(tkwin)))) {
	    if ((wmPtr->width == -1) && (width == winPtr->reqWidth)) {

		/*
		 * Don't set external width, since the user didn't change it