diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-11-24 10:48:04 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-11-24 10:48:04 (GMT) |
commit | a76a39c11215d1540aef83b53115c54bf6e6a880 (patch) | |
tree | c15e50c5a7736975ff4bfc7dcc4b0e84033c01de /macosx/tkMacOSXSubwindows.c | |
parent | d815dabf0d14778b19acc0bd6b9264756d25d5c4 (diff) | |
parent | 6b9b678f9baccfa26a0f82519ef19ed3284f7bfe (diff) | |
download | tk-a76a39c11215d1540aef83b53115c54bf6e6a880.zip tk-a76a39c11215d1540aef83b53115c54bf6e6a880.tar.gz tk-a76a39c11215d1540aef83b53115c54bf6e6a880.tar.bz2 |
Merge 8.6
Diffstat (limited to 'macosx/tkMacOSXSubwindows.c')
-rw-r--r-- | macosx/tkMacOSXSubwindows.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c index 8b55c38..e8d8b22 100644 --- a/macosx/tkMacOSXSubwindows.c +++ b/macosx/tkMacOSXSubwindows.c @@ -148,6 +148,8 @@ XMapWindow( TkWindow *winPtr = macWin->winPtr; NSWindow *win = TkMacOSXGetNSWindowForDrawable(window); static Bool initialized = NO; + NSPoint mouse = [NSEvent mouseLocation]; + int x = mouse.x, y = TkMacOSXZeroScreenHeight() - mouse.y; /* * Under certain situations it's possible for this function to be called @@ -185,6 +187,16 @@ XMapWindow( [win orderFrontRegardless]; } } + + /* + * Call Tk_UpdatePointer to tell Tk whether the pointer is in the + * new window. + */ + + NSPoint viewLocation = [view convertPoint:mouse fromView:nil]; + if (NSPointInRect(viewLocation, NSInsetRect([view bounds], 2, 2))) { + Tk_UpdatePointer((Tk_Window) winPtr, x, y, [NSApp tkButtonState]); + } } else { TkWindow *contWinPtr = TkpGetOtherWindow(winPtr); @@ -296,6 +308,9 @@ XUnmapWindow( TkWindow *winPtr = macWin->winPtr; TkWindow *parentPtr = winPtr->parentPtr; NSWindow *win = TkMacOSXGetNSWindowForDrawable(window); + NSPoint mouse = [NSEvent mouseLocation]; + int x = mouse.x, y = TkMacOSXZeroScreenHeight() - mouse.y; + int state = TkMacOSXButtonKeyState(); if (!window) { return BadWindow; @@ -356,6 +371,7 @@ XUnmapWindow( if (view != [NSView focusView]) { [view addTkDirtyRect:[view bounds]]; } + Tk_UpdatePointer(NULL, x, y, state); return Success; } |