Tk Source Code

Check-in [a7bafc45]
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 | core-8-6-branch
Files: files | file ages | folders
SHA3-256:a7bafc4548705cf1eb846dab5d320ed533a22237be9a6a17ef06b664a532666b
User & Date: culler 2019-02-13 12:43:57
Context
2019-02-13
21:01
Fix bug [2249e64bdc]: adjust unixWm tests which expect impossible results on Aqua. check-in: 30198903 user: culler tags: core-8-6-branch
15:49
Fix bug [2249e64bdc]: Some unixWm tests expect the impossible on Aqua check-in: 9a0e3174 user: culler tags: bug-2249e64bdc
12:45
Fix bug [b389dfcd8f]: Aqua miscalculates window position on secondary display. check-in: a28f811e user: culler tags: trunk
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
..
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
...
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
			 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)) {
................................................................................
	     * 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.
................................................................................
     */

    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







<




|







 







|







 







<







71
72
73
74
75
76
77

78
79
80
81
82
83
84
85
86
87
88
89
..
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
...
677
678
679
680
681
682
683

684
685
686
687
688
689
690
			 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)) {
................................................................................
	     * 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.
................................................................................
     */

    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