summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorculler <culler>2019-10-27 19:21:13 (GMT)
committerculler <culler>2019-10-27 19:21:13 (GMT)
commitd95d56ad6573cbc56ab366dab366b18150f0e811 (patch)
treea45fe6c02e1f2fc831d0dea8ebfcf2ca30cf4dae
parentcd2e85da01cbcc264954b6b36912b49b5a17bbcd (diff)
downloadtk-d95d56ad6573cbc56ab366dab366b18150f0e811.zip
tk-d95d56ad6573cbc56ab366dab366b18150f0e811.tar.gz
tk-d95d56ad6573cbc56ab366dab366b18150f0e811.tar.bz2
For Aqua, fix computation of local.x and local.y in the case of an embedded toplevel.
-rw-r--r--macosx/tkMacOSXMouseEvent.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c
index 56c6431..4af80b6 100644
--- a/macosx/tkMacOSXMouseEvent.c
+++ b/macosx/tkMacOSXMouseEvent.c
@@ -130,7 +130,8 @@ enum {
}
/*
- * Make sure tkwin is the toplevel which should receive the event.
+ * If we still don't have a window, try using the toplevel that
+ * manages the NSWindow.
*/
if (!tkwin) {
@@ -138,10 +139,15 @@ enum {
tkwin = (Tk_Window) winPtr;
}
if (!tkwin) {
+
+ /*
+ * We can't find a window for this event. We have to ignore it.
+ */
+
#ifdef TK_MAC_DEBUG_EVENTS
TkMacOSXDbgMsg("tkwin == NULL");
#endif
- return theEvent; /* Give up. No window for this event. */
+ return theEvent;
}
/*
@@ -174,8 +180,20 @@ enum {
* coordinates.
*/
- local.x -= winPtr->wmInfoPtr->xInParent;
- local.y -= winPtr->wmInfoPtr->yInParent;
+ if (Tk_IsEmbedded(winPtr)) {
+ TkWindow *contPtr = TkpGetOtherWindow(winPtr);
+ if (Tk_IsTopLevel(contPtr)) {
+ local.x -= contPtr->wmInfoPtr->xInParent;
+ local.y -= contPtr->wmInfoPtr->yInParent;
+ } else {
+ TkWindow *topPtr = TkMacOSXGetHostToplevel(winPtr)->winPtr;
+ local.x -= (topPtr->wmInfoPtr->xInParent + contPtr->changes.x);
+ local.y -= (topPtr->wmInfoPtr->yInParent + contPtr->changes.y);
+ }
+ } else {
+ local.x -= winPtr->wmInfoPtr->xInParent;
+ local.y -= winPtr->wmInfoPtr->yInParent;
+ }
/*
* Find the containing Tk window, and convert local into the coordinates