summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXMouseEvent.c
diff options
context:
space:
mode:
authormarc_culler <marc.culler@gmail.com>2020-09-14 15:03:44 (GMT)
committermarc_culler <marc.culler@gmail.com>2020-09-14 15:03:44 (GMT)
commit0e6c603dbde531da22b1b65b987b69e463761b4a (patch)
tree08dcee3a8d07c066790e6118f4f8d7f07859148d /macosx/tkMacOSXMouseEvent.c
parentad861a0433fe3325ce081e6df2b40ed7fd670fe9 (diff)
downloadtk-0e6c603dbde531da22b1b65b987b69e463761b4a.zip
tk-0e6c603dbde531da22b1b65b987b69e463761b4a.tar.gz
tk-0e6c603dbde531da22b1b65b987b69e463761b4a.tar.bz2
Fix [71e18c5c0a]: Aqua invalid selector crash when switching between normal and full screen mode.
Diffstat (limited to 'macosx/tkMacOSXMouseEvent.c')
-rw-r--r--macosx/tkMacOSXMouseEvent.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c
index 9e57e7d..00477dd 100644
--- a/macosx/tkMacOSXMouseEvent.c
+++ b/macosx/tkMacOSXMouseEvent.c
@@ -54,6 +54,7 @@ enum {
NSWindow *eventWindow = [theEvent window];
NSEventType eventType = [theEvent type];
NSRect viewFrame = [[eventWindow contentView] frame];
+ NSPoint location = [theEvent locationInWindow];
TkWindow *winPtr = NULL, *grabWinPtr;
Tk_Window tkwin = None, capture, target;
NSPoint local, global;
@@ -71,13 +72,12 @@ enum {
* If this event is not for a Tk toplevel, it should just be passed up the
* responder chain. However, there is an exception for synthesized events,
* which are used in testing. Those events are recognized by having their
- * (unused) pressure field set to the impossible value -1.0.
+ * (unused) context pointer set to 1.
*/
- if (![eventWindow isMemberOfClass:[TKWindow class]]) {
- if (eventWindow && [theEvent pressure] != -1.0) {
+ if (eventWindow && ![eventWindow isMemberOfClass:[TKWindow class]]) {
+ if ([theEvent context] != (void *) 1)
return theEvent;
- }
}
/*
@@ -85,8 +85,9 @@ enum {
*/
if (eventWindow) {
- inTitleBar = viewFrame.size.height < [theEvent locationInWindow].y;
+ inTitleBar = viewFrame.size.height < location.y;
}
+
button = [theEvent buttonNumber] + Button1;
switch (eventType) {
case NSRightMouseUp:
@@ -101,13 +102,16 @@ enum {
buttonState |= TkGetButtonMask(button);
break;
case NSMouseEntered:
- if (!inTitleBar) {
+ if ([eventWindow respondsToSelector:@selector(mouseInResizeArea)] &&
+ !inTitleBar) {
[(TKWindow *)eventWindow setMouseInResizeArea:YES];
}
break;
case NSMouseExited:
- [(TKWindow *)eventWindow setMouseInResizeArea:NO];
- break;
+ if ([eventWindow respondsToSelector:@selector(mouseInResizeArea)]) {
+ [(TKWindow *)eventWindow setMouseInResizeArea:NO];
+ break;
+ }
case NSLeftMouseUp:
case NSLeftMouseDown:
case NSMouseMoved:
@@ -129,8 +133,8 @@ enum {
*/
if (eventType == NSLeftMouseDown || eventType == NSLeftMouseDragged) {
- if ([(TKWindow *)eventWindow mouseInResizeArea] &&
- ([eventWindow styleMask] & NSResizableWindowMask)) {
+ if ([eventWindow respondsToSelector:@selector(mouseInResizeArea)] &&
+ [(TKWindow *) eventWindow mouseInResizeArea]) {
/*
* When the left button is pressed in the resize area, we receive