summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorculler <culler>2024-05-24 15:30:48 (GMT)
committerculler <culler>2024-05-24 15:30:48 (GMT)
commit285f6cdbf8bad836d1de14c2dd11f7e86daeeb8e (patch)
tree41ee44fd49f6aa91206d7d9a5e0fba227900ceef
parentc4c94b611dab530185007be10efece9695dcdb72 (diff)
downloadtk-285f6cdbf8bad836d1de14c2dd11f7e86daeeb8e.zip
tk-285f6cdbf8bad836d1de14c2dd11f7e86daeeb8e.tar.gz
tk-285f6cdbf8bad836d1de14c2dd11f7e86daeeb8e.tar.bz2
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).
-rw-r--r--macosx/tkMacOSXWm.c13
-rw-r--r--tests/unixWm.test2
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.