summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarc_culler <marc.culler@gmail.com>2021-12-20 01:07:47 (GMT)
committermarc_culler <marc.culler@gmail.com>2021-12-20 01:07:47 (GMT)
commitc78ed6cd94f2aefa3268c4901af10cafae29c3d3 (patch)
tree36378aa8db85ad55824693e913452afb380a9422
parenta95f9f1b08a27165ffce03db777aad7e1660a3b0 (diff)
downloadtk-c78ed6cd94f2aefa3268c4901af10cafae29c3d3.zip
tk-c78ed6cd94f2aefa3268c4901af10cafae29c3d3.tar.gz
tk-c78ed6cd94f2aefa3268c4901af10cafae29c3d3.tar.bz2
Make target not be static in processMouseEvent.
-rw-r--r--macosx/tkMacOSXMouseEvent.c8
-rw-r--r--macosx/tkMacOSXWm.c6
2 files changed, 9 insertions, 5 deletions
diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c
index b96d487..1a72c65 100644
--- a/macosx/tkMacOSXMouseEvent.c
+++ b/macosx/tkMacOSXMouseEvent.c
@@ -83,8 +83,8 @@ enum {
NSPoint location = [theEvent locationInWindow];
NSPoint viewLocation = [contentView convertPoint:location fromView:nil];
TkWindow *winPtr = NULL, *grabWinPtr, *scrollTarget = NULL;
- Tk_Window tkwin = NULL, capture;
- static Tk_Window target = NULL, dragTarget = NULL;
+ Tk_Window tkwin = NULL, capture, target;
+ static Tk_Window dragTarget = NULL;
NSPoint local, global;
NSInteger button;
TkWindow *newFocus = NULL;
@@ -130,8 +130,8 @@ enum {
}
dragTarget = NULL;
target = TkMacOSXGetTkWindow([NSApp keyWindow]);
- isDragging = NO;
[NSApp setTkEventTarget: target];
+ isDragging = NO;
} else if (!NSPointInRect(viewLocation, [contentView bounds])) {
isOutside = YES;
}
@@ -149,7 +149,7 @@ enum {
return theEvent;
}
isDragging = YES;
- dragTarget = target;
+ dragTarget = [NSApp tkEventTarget];
break;
case NSRightMouseDragged:
case NSOtherMouseDragged:
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index cdfc1a1..8d8a8c1 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -1058,7 +1058,9 @@ TkWmDeadWindow(
*/
deadNSWindow = (TKWindow *)wmPtr->window;
- [deadNSWindow setIsDead:YES];
+ if ([deadNSWindow respondsToSelector:@selector(setIsDead)]) {
+ [deadNSWindow setIsDead:YES];
+ }
if (deadNSWindow && !Tk_IsEmbedded(winPtr)) {
NSWindow *parent = [deadNSWindow parentWindow];
[deadNSWindow setTkWindow:None];
@@ -1107,6 +1109,7 @@ TkWmDeadWindow(
wmPtr2->hints.initial_state != WithdrawnState);
if (w != deadNSWindow && isOnScreen && [w canBecomeKeyWindow]) {
[w makeKeyAndOrderFront:NSApp];
+ [NSApp setTkEventTarget:TkMacOSXGetTkWindow(w)];
break;
}
}
@@ -6646,6 +6649,7 @@ TkpChangeFocus(
}
if (win && [win canBecomeKeyWindow]) {
[win makeKeyAndOrderFront:NSApp];
+ [NSApp setTkEventTarget:TkMacOSXGetTkWindow(win)];
}
}