Tk Source Code

Artifact [a01e9e00]
Login

Artifact a01e9e0079deba9e3b8a0efa7e7698321a271751:

Attachment "tk.patch" to ticket [e2f801f6] added by anonymous 2014-01-23 14:41:23. (unpublished)
diff -rc tk8.6.1_old/macosx/tkMacOSXEvent.c tk8.6.1_new/macosx/tkMacOSXEvent.c
*** tk8.6.1_old/macosx/tkMacOSXEvent.c	Tue Sep  3 21:52:36 2013
--- tk8.6.1_new/macosx/tkMacOSXEvent.c	Thu Jan 23 23:26:15 2014
***************
*** 23,34 ****
  
  @implementation TKApplication(TKEvent)
  /* TODO: replace by +[addLocalMonitorForEventsMatchingMask ? */
! - (NSEvent *) tkProcessEvent: (NSEvent *) theEvent
  {
  #ifdef TK_MAC_DEBUG_EVENTS
      TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, theEvent);
  #endif
-     NSEvent	    *processedEvent = theEvent;
      NSEventType	    type = [theEvent type];
      NSInteger	    subtype;
      NSUInteger	    flags;
--- 23,33 ----
  
  @implementation TKApplication(TKEvent)
  /* TODO: replace by +[addLocalMonitorForEventsMatchingMask ? */
! - (void) tkProcessEvent: (NSEvent *) theEvent
  {
  #ifdef TK_MAC_DEBUG_EVENTS
      TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, theEvent);
  #endif
      NSEventType	    type = [theEvent type];
      NSInteger	    subtype;
      NSUInteger	    flags;
***************
*** 58,64 ****
      case NSKeyDown:
      case NSFlagsChanged:
  	flags = [theEvent modifierFlags];
! 	processedEvent = [self tkProcessKeyEvent:theEvent];
  	break;
      case NSLeftMouseDown:
      case NSLeftMouseUp:
--- 57,63 ----
      case NSKeyDown:
      case NSFlagsChanged:
  	flags = [theEvent modifierFlags];
! 	[self tkProcessKeyEvent:theEvent];
  	break;
      case NSLeftMouseDown:
      case NSLeftMouseUp:
***************
*** 75,81 ****
      case NSOtherMouseDragged:
      case NSTabletPoint:
      case NSTabletProximity:
! 	processedEvent = [self tkProcessMouseEvent:theEvent];
  	break;
  #if 0
      case NSSystemDefined:
--- 74,80 ----
      case NSOtherMouseDragged:
      case NSTabletPoint:
      case NSTabletProximity:
! 	[self tkProcessMouseEvent:theEvent];
  	break;
  #if 0
      case NSSystemDefined:
***************
*** 102,108 ****
      default:
  	break;
      }
-     return processedEvent;
  }
  @end
  
--- 101,106 ----
diff -rc tk8.6.1_old/macosx/tkMacOSXKeyEvent.c tk8.6.1_new/macosx/tkMacOSXKeyEvent.c
*** tk8.6.1_old/macosx/tkMacOSXKeyEvent.c	Tue Sep  3 21:52:36 2013
--- tk8.6.1_new/macosx/tkMacOSXKeyEvent.c	Thu Jan 23 23:27:53 2014
***************
*** 42,48 ****
  
  @implementation TKApplication(TKKeyEvent)
  
! - (NSEvent *) tkProcessKeyEvent: (NSEvent *) theEvent
  {
  #ifdef TK_MAC_DEBUG_EVENTS
      TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, theEvent);
--- 42,48 ----
  
  @implementation TKApplication(TKKeyEvent)
  
! - (void) tkProcessKeyEvent: (NSEvent *) theEvent
  {
  #ifdef TK_MAC_DEBUG_EVENTS
      TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, theEvent);
***************
*** 68,74 ****
          {
            // if we were composing, swallow the last release since we already sent
            finishedCompose = NO;
!           return theEvent;
          }
      case NSKeyDown:
  	repeat = [theEvent isARepeat];
--- 68,74 ----
          {
            // if we were composing, swallow the last release since we already sent
            finishedCompose = NO;
!           return;
          }
      case NSKeyDown:
  	repeat = [theEvent isARepeat];
***************
*** 85,91 ****
  	break;
  
      default:
! 	return theEvent;
      }
  
      if (!processingCompose) {
--- 85,91 ----
  	break;
  
      default:
! 	return;
      }
  
      if (!processingCompose) {
***************
*** 123,134 ****
  
          if (!tkwin) {
            TkMacOSXDbgMsg("tkwin == NULL");
!           return theEvent;
          }
          tkwin = (Tk_Window) winPtr->dispPtr->focusPtr;
          if (!tkwin) {
            TkMacOSXDbgMsg("tkwin == NULL");
!           return theEvent;
          }
  
          /*
--- 123,134 ----
  
          if (!tkwin) {
            TkMacOSXDbgMsg("tkwin == NULL");
!           return;
          }
          tkwin = (Tk_Window) winPtr->dispPtr->focusPtr;
          if (!tkwin) {
            TkMacOSXDbgMsg("tkwin == NULL");
!           return;
          }
  
          /*
***************
*** 187,193 ****
                    /* prevent SF bug 2907388 (crash on some composite chars) */
                    //PENDING: we might not need this anymore
                    TkMacOSXDbgMsg("characters too long");
!                   return theEvent;
                  }
                }
  
--- 187,193 ----
                    /* prevent SF bug 2907388 (crash on some composite chars) */
                    //PENDING: we might not need this anymore
                    TkMacOSXDbgMsg("characters too long");
!                   return;
                  }
                }
  
***************
*** 199,205 ****
              }
              Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL);
              savedModifiers = modifiers;
!             return theEvent;
            }  /* if send straight to TK */
  
        }  /* if not processing compose */
--- 199,205 ----
              }
              Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL);
              savedModifiers = modifiers;
!             return;
            }  /* if send straight to TK */
  
        }  /* if not processing compose */
***************
*** 216,222 ****
  
      savedModifiers = modifiers;
  
!     return theEvent;
  }
  @end
  
--- 216,222 ----
  
      savedModifiers = modifiers;
  
!     return;
  }
  @end
  
diff -rc tk8.6.1_old/macosx/tkMacOSXMouseEvent.c tk8.6.1_new/macosx/tkMacOSXMouseEvent.c
*** tk8.6.1_old/macosx/tkMacOSXMouseEvent.c	Tue Sep  3 21:52:36 2013
--- tk8.6.1_new/macosx/tkMacOSXMouseEvent.c	Thu Jan 23 23:28:58 2014
***************
*** 35,41 ****
  };
  
  @implementation TKApplication(TKMouseEvent)
! - (NSEvent *) tkProcessMouseEvent: (NSEvent *) theEvent
  {
  #ifdef TK_MAC_DEBUG_EVENTS
      TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, theEvent);
--- 35,41 ----
  };
  
  @implementation TKApplication(TKMouseEvent)
! - (void) tkProcessMouseEvent: (NSEvent *) theEvent
  {
  #ifdef TK_MAC_DEBUG_EVENTS
      TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, theEvent);
***************
*** 83,90 ****
          break;
  
      default:
! 	return theEvent;
! 	break;
      }
  
      NSPoint global, local = [theEvent locationInWindow];
--- 83,89 ----
          break;
  
      default:
! 	return;
      }
  
      NSPoint global, local = [theEvent locationInWindow];
***************
*** 105,111 ****
  	tkwin = TkMacOSXGetCapture();
      }
      if (!tkwin) {
! 	return theEvent;
      }
  
      /*
--- 104,110 ----
  	tkwin = TkMacOSXGetCapture();
      }
      if (!tkwin) {
! 	return;
      }
  
      /*
***************
*** 206,212 ****
  	}
      }
  
!     return theEvent;
  }
  @end
  
--- 205,211 ----
  	}
      }
  
!     return;
  }
  @end
  
diff -rc tk8.6.1_old/macosx/tkMacOSXNotify.c tk8.6.1_new/macosx/tkMacOSXNotify.c
*** tk8.6.1_old/macosx/tkMacOSXNotify.c	Thu Jan 23 23:32:21 2014
--- tk8.6.1_new/macosx/tkMacOSXNotify.c	Thu Jan 23 23:24:09 2014
***************
*** 49,60 ****
  
      if (event) {
  	TSD_INIT();
! 	if (tsdPtr->sendEventNestingLevel) {
! 	    if (![NSApp tkProcessEvent:event]) {
! 		[event release];
! 		event = nil;
! 	    }
! 	}
      }
      [pool drain];
      return [event autorelease];
--- 49,55 ----
  
      if (event) {
  	TSD_INIT();
! 	if (tsdPtr->sendEventNestingLevel) [NSApp tkProcessEvent:event];
      }
      [pool drain];
      return [event autorelease];
***************
*** 277,298 ****
  	    if (tkMacOSXGCEnabled) {
  		objc_clear_stack(0);
  	    }
! 	    if (![NSApp tkProcessEvent:currentEvent]) {
! 		[currentEvent release];
! 		currentEvent = nil;
! 	    }
! 	    if (currentEvent) {
  #ifdef TK_MAC_DEBUG_EVENTS
! 		TKLog(@"   event: %@", currentEvent);
  #endif
! 		if (modalSession) {
! 		    [NSApp _modalSession:modalSession sendEvent:currentEvent];
! 		} else {
! 		    [NSApp sendEvent:currentEvent];
! 		}
! 		[currentEvent release];
! 		currentEvent = nil;
  	    }
  	    [pool drain];
  	    pool = nil;
  	} while (1);
--- 272,288 ----
  	    if (tkMacOSXGCEnabled) {
  		objc_clear_stack(0);
  	    }
! 	    [NSApp tkProcessEvent:currentEvent];
  #ifdef TK_MAC_DEBUG_EVENTS
! 	    TKLog(@"   event: %@", currentEvent);
  #endif
! 	    if (modalSession) {
! 		[NSApp _modalSession:modalSession sendEvent:currentEvent];
! 	    } else {
! 		[NSApp sendEvent:currentEvent];
  	    }
+ 	    [currentEvent release];
+ 	    currentEvent = nil;
  	    [pool drain];
  	    pool = nil;
  	} while (1);
diff -rc tk8.6.1_old/macosx/tkMacOSXPrivate.h tk8.6.1_new/macosx/tkMacOSXPrivate.h
*** tk8.6.1_old/macosx/tkMacOSXPrivate.h	Tue Sep  3 21:52:36 2013
--- tk8.6.1_new/macosx/tkMacOSXPrivate.h	Thu Jan 23 23:26:46 2014
***************
*** 299,311 ****
  - (NSString *)tkFrameworkImagePath:(NSString*)image;
  @end
  @interface TKApplication(TKEvent)
! - (NSEvent *)tkProcessEvent:(NSEvent *)theEvent;
  @end
  @interface TKApplication(TKMouseEvent)
! - (NSEvent *)tkProcessMouseEvent:(NSEvent *)theEvent;
  @end
  @interface TKApplication(TKKeyEvent)
! - (NSEvent *)tkProcessKeyEvent:(NSEvent *)theEvent;
  @end
  @interface TKApplication(TKMenu)
  - (void)tkSetMainMenu:(TKMenu *)menu;
--- 299,311 ----
  - (NSString *)tkFrameworkImagePath:(NSString*)image;
  @end
  @interface TKApplication(TKEvent)
! - (void)tkProcessEvent:(NSEvent *)theEvent;
  @end
  @interface TKApplication(TKMouseEvent)
! - (void)tkProcessMouseEvent:(NSEvent *)theEvent;
  @end
  @interface TKApplication(TKKeyEvent)
! - (void)tkProcessKeyEvent:(NSEvent *)theEvent;
  @end
  @interface TKApplication(TKMenu)
  - (void)tkSetMainMenu:(TKMenu *)menu;