From 285f6cdbf8bad836d1de14c2dd11f7e86daeeb8e Mon Sep 17 00:00:00 2001 From: culler Date: Fri, 24 May 2024 15:30:48 +0000 Subject: Fix bug introduced in FrontWindowAtPoint which causes unixWm-50.1 to fail by ignoring that the pointer is in a titlebar. Also, make the unixWm-50 tests more robust by ensuring that the root window is out of the way. (This matters for macOS 14, not 11). --- macosx/tkMacOSXWm.c | 13 +++++++++++-- tests/unixWm.test | 2 ++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 6c7468a..e782dda 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -623,17 +623,26 @@ FrontWindowAtPoint( for (NSWindow *w in windows) { winPtr = TkMacOSXGetTkWindow(w); if (winPtr) { + // WmInfo *wmPtr = winPtr->wmInfoPtr; NSRect windowFrame = [w frame]; - NSRect contentFrame = windowFrame; + NSRect contentFrame = [w frame]; + + contentFrame.size.height = [[w contentView] frame].size.height; /* * For consistency with other platforms, points in the * title bar are not considered to be contained in the * window. */ - contentFrame.size.height = [[w contentView] frame].size.height; if (NSMouseInRect(p, contentFrame, NO)) { return winPtr; + } else if (NSMouseInRect(p, windowFrame, NO)) { + /* + * The pointer is in the title bar of the highest NSWindow + * containing it, and therefore is should not be considered + * to be contained in any Tk window. + */ + return NULL; } } } diff --git a/tests/unixWm.test b/tests/unixWm.test index 472db21..65561d4 100644 --- a/tests/unixWm.test +++ b/tests/unixWm.test @@ -1806,6 +1806,8 @@ test unixWm-49.2 {Tk_GetRootCoords procedure, menubars} {unix testmenubar} { } {52 7 12 62} deleteWindows +# Make sure that the root window is out of the way! +wm geom . +700+700 wm withdraw . if {[tk windowingsystem] eq "aqua"} { # Modern mac windows have no border. -- cgit v0.12