NSApp updates

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4549 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1999-07-09 08:27:04 +00:00
parent 7ae65acf69
commit 7084274d82
4 changed files with 290 additions and 390 deletions

View file

@ -1,3 +1,13 @@
Fri Jul 9 9:33:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Headers/AppKit/NSApplication.h: Removed delegate methods from
NSApplication, and put them in a protocol instead. Removed obsolete
backend method.
* Source/NSApplication.m: Removed delegate methods. Removed code
that intercepted the right mouse button.
* Source/NSResponder.m: Added code so that the last responder will
pop-up the main menu if NSRightMouseDown has not been handled.
Tue Jul 6 21:45:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Headers/AppKit/NSGraphicsContext.h: Added new method to perform

View file

@ -3,7 +3,7 @@
The one and only application class
Copyright (C) 1996 Free Software Foundation, Inc.
Copyright (C) 1996,1999 Free Software Foundation, Inc.
Author: Scott Christley <scottc@net-community.com>
Date: 1996
@ -55,227 +55,202 @@ enum {
NSRunContinuesResponse
};
extern NSString *NSModalPanelRunLoopMode;
extern NSString *NSEventTrackingRunLoopMode;
extern NSString *NSModalPanelRunLoopMode;
extern NSString *NSEventTrackingRunLoopMode;
@interface NSApplication : NSResponder <NSCoding>
{
// Attributes
NSEvent *current_event;
NSModalSession session;
id key_window;
id main_window;
id delegate;
id listener;
NSMenu *main_menu;
NSMenuItem *windows_menu;
unsigned int current_mod;
BOOL app_is_running;
BOOL app_should_quit;
BOOL app_is_active;
BOOL app_is_hidden;
BOOL unhide_on_activation;
BOOL windows_need_update;
NSImage *app_icon;
NSEvent *current_event;
NSModalSession session;
NSWindow *key_window;
NSWindow *main_window;
id delegate;
id listener;
NSMenu *main_menu;
NSMenuItem *windows_menu;
unsigned current_mod;
BOOL app_is_running;
BOOL app_should_quit;
BOOL app_is_active;
BOOL app_is_hidden;
BOOL unhide_on_activation;
BOOL windows_need_update;
NSImage *app_icon;
BOOL inTrackingLoop;
BOOL inTrackingLoop;
// Reserved for back-end use
void *be_app_reserved;
}
//
// Class methods
//
//
// Creating and initializing the NSApplication
//
+ (NSApplication *)sharedApplication;
/*
* Class methods
*/
//
// Instance methods
//
//
// Creating and initializing the NSApplication
//
- (void)finishLaunching;
/*
* Creating and initializing the NSApplication
*/
+ (NSApplication*) sharedApplication;
//
// Changing the active application
//
- (void)activateIgnoringOtherApps:(BOOL)flag;
- (void)deactivate;
- (BOOL)isActive;
/*
* Instance methods
*/
//
// Running the event loop
//
- (void)abortModal;
- (NSModalSession)beginModalSessionForWindow:(NSWindow *)theWindow;
- (void)endModalSession:(NSModalSession)theSession;
- (BOOL)isRunning;
- (void)run;
- (int)runModalForWindow:(NSWindow *)theWindow;
- (int)runModalSession:(NSModalSession)theSession;
- (void)sendEvent:(NSEvent *)theEvent;
- (void)stop:sender;
- (void)stopModal;
- (void)stopModalWithCode:(int)returnCode;
/*
* Creating and initializing the NSApplication
*/
- (void) finishLaunching;
//
// Getting, removing, and posting events
//
- (NSEvent *)currentEvent;
- (void)discardEventsMatchingMask:(unsigned int)mask
beforeEvent:(NSEvent *)lastEvent;
- (NSEvent *)nextEventMatchingMask:(unsigned int)mask
untilDate:(NSDate *)expiration
inMode:(NSString *)mode
dequeue:(BOOL)flag;
- (void)postEvent:(NSEvent *)event atStart:(BOOL)flag;
/*
* Changing the active application
*/
- (void) activateIgnoringOtherApps: (BOOL)flag;
- (void) deactivate;
- (BOOL) isActive;
//
// Sending action messages
//
- (BOOL)sendAction:(SEL)aSelector
to:aTarget
from:sender;
- targetForAction:(SEL)aSelector;
- (BOOL)tryToPerform:(SEL)aSelector
with:anObject;
/*
* Running the event loop
*/
- (void) abortModal;
- (NSModalSession) beginModalSessionForWindow: (NSWindow*)theWindow;
- (void) endModalSession: (NSModalSession)theSession;
- (BOOL) isRunning;
- (void) run;
- (int) runModalForWindow: (NSWindow*)theWindow;
- (int) runModalSession: (NSModalSession)theSession;
- (void) sendEvent: (NSEvent*)theEvent;
- (void) stop: (id)sender;
- (void) stopModal;
- (void) stopModalWithCode: (int)returnCode;
//
// Setting the application's icon
//
- (void)setApplicationIconImage:(NSImage *)anImage;
- (NSImage *)applicationIconImage;
/*
* Getting, removing, and posting events
*/
- (NSEvent*) currentEvent;
- (void) discardEventsMatchingMask: (unsigned)mask
beforeEvent: (NSEvent*)lastEvent;
- (NSEvent*) nextEventMatchingMask: (unsigned)mask
untilDate: (NSDate*)expiration
inMode: (NSString*)mode
dequeue: (BOOL)flag;
- (void) postEvent: (NSEvent*)event atStart: (BOOL)flag;
//
// Hiding all windows
//
- (void)hide:sender;
- (BOOL)isHidden;
- (void)unhide:sender;
- (void)unhideWithoutActivation;
/*
* Sending action messages
*/
- (BOOL) sendAction: (SEL)aSelector
to: (id)aTarget
from: (id)sender;
- (id) targetForAction: (SEL)aSelector;
- (BOOL) tryToPerform: (SEL)aSelector
with: (id)anObject;
//
// Managing windows
//
- (NSWindow *)keyWindow;
- (NSWindow *)mainWindow;
- (NSWindow *)makeWindowsPerform:(SEL)aSelector
inOrder:(BOOL)flag;
- (void)miniaturizeAll:sender;
- (void)preventWindowOrdering;
- (void)setWindowsNeedUpdate:(BOOL)flag;
- (void)updateWindows;
- (NSArray *)windows;
- (NSWindow *)windowWithWindowNumber:(int)windowNum;
/*
* Setting the application's icon
*/
- (void) setApplicationIconImage: (NSImage*)anImage;
- (NSImage*) applicationIconImage;
//
// Showing Standard Panels
//
- (void)orderFrontColorPanel:sender;
- (void)orderFrontDataLinkPanel:sender;
- (void)orderFrontHelpPanel:sender;
- (void)runPageLayout:sender;
/*
* Hiding all windows
*/
- (void) hide: (id)sender;
- (BOOL) isHidden;
- (void) unhide: (id)sender;
- (void) unhideWithoutActivation;
//
// Getting the main menu
//
- (NSMenu *)mainMenu;
- (void)setMainMenu:(NSMenu *)aMenu;
/*
* Managing windows
*/
- (NSWindow*) keyWindow;
- (NSWindow*) mainWindow;
- (NSWindow*) makeWindowsPerform: (SEL)aSelector
inOrder: (BOOL)flag;
- (void) miniaturizeAll: (id)sender;
- (void) preventWindowOrdering;
- (void) setWindowsNeedUpdate: (BOOL)flag;
- (void) updateWindows;
- (NSArray*) windows;
- (NSWindow*) windowWithWindowNumber: (int)windowNum;
//
// Managing the Windows menu
//
- (void)addWindowsItem:aWindow
title:(NSString *)aString
filename:(BOOL)isFilename;
- (void)arrangeInFront:sender;
- (void)changeWindowsItem:aWindow
title:(NSString *)aString
filename:(BOOL)isFilename;
- (void)removeWindowsItem:aWindow;
- (void)setWindowsMenu:aMenu;
- (void)updateWindowsItem:aWindow;
- (NSMenu *)windowsMenu;
/*
* Showing Standard Panels
*/
- (void) orderFrontColorPanel: (id)sender;
- (void) orderFrontDataLinkPanel: (id)sender;
- (void) orderFrontHelpPanel: (id)sender;
- (void) runPageLayout: (id)sender;
//
// Managing the Service menu
//
- (void)registerServicesMenuSendTypes:(NSArray *)sendTypes
returnTypes:(NSArray *)returnTypes;
- (NSMenu *)servicesMenu;
- (id)servicesProvider;
- (void)setServicesMenu:(NSMenu *)aMenu;
- (void)setServicesProvider:(id)anObject;
- validRequestorForSendType:(NSString *)sendType
returnType:(NSString *)returnType;
/*
* Getting the main menu
*/
- (NSMenu*) mainMenu;
- (void) setMainMenu: (NSMenu*)aMenu;
//
// Getting the display context
//
- (NSGraphicsContext *)context;
/*
* Managing the Windows menu
*/
- (void) addWindowsItem: (NSWindow*)aWindow
title: (NSString*)aString
filename: (BOOL)isFilename;
- (void) arrangeInFront: (id)sender;
- (void) changeWindowsItem: (NSWindow*)aWindow
title: (NSString*)aString
filename: (BOOL)isFilename;
- (void) removeWindowsItem: (NSWindow*)aWindow;
- (void) setWindowsMenu: (NSMenu*)aMenu;
- (void) updateWindowsItem: (NSWindow*)aWindow;
- (NSMenu*) windowsMenu;
//
// Reporting an exception
//
- (void)reportException:(NSException *)anException;
/*
* Managing the Service menu
*/
- (void) registerServicesMenuSendTypes: (NSArray*)sendTypes
returnTypes: (NSArray*)returnTypes;
- (NSMenu*) servicesMenu;
- (id) servicesProvider;
- (void) setServicesMenu: (NSMenu*)aMenu;
- (void) setServicesProvider: (id)anObject;
- (id) validRequestorForSendType: (NSString*)sendType
returnType: (NSString*)returnType;
//
// Terminating the application
//
- (void)terminate:sender;
/*
* Getting the display context
*/
- (NSGraphicsContext*) context;
//
// Assigning a delegate
//
- delegate;
- (void)setDelegate:anObject;
/*
* Reporting an exception
*/
- (void) reportException: (NSException*)anException;
//
// Implemented by the delegate
//
- (BOOL)application:sender openFileWithoutUI:(NSString *)filename;
- (BOOL)application:(NSApplication *)app openFile:(NSString *)filename;
- (BOOL)application:(NSApplication *)app openTempFile:(NSString *)filename;
- (void)applicationDidBecomeActive:(NSNotification *)aNotification;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification;
- (void)applicationDidHide:(NSNotification *)aNotification;
- (void)applicationDidResignActive:(NSNotification *)aNotification;
- (void)applicationDidUnhide:(NSNotification *)aNotification;
- (void)applicationDidUpdate:(NSNotification *)aNotification;
- (BOOL)applicationOpenUntitledFile:(NSApplication *)app;
- (BOOL)applicationShouldTerminate:sender;
- (void)applicationWillBecomeActive:(NSNotification *)aNotification;
- (void)applicationWillFinishLaunching:(NSNotification *)aNotification;
- (void)applicationWillHide:(NSNotification *)aNotification;
- (void)applicationWillResignActive:(NSNotification *)aNotification;
- (void)applicationWillUnhide:(NSNotification *)aNotification;
- (void)applicationWillUpdate:(NSNotification *)aNotification;
/*
* Terminating the application
*/
- (void) terminate: (id)sender;
//
// NSCoding protocol
//
- (void)encodeWithCoder:aCoder;
- initWithCoder:aDecoder;
/*
* Assigning a delegate
*/
- (id) delegate;
- (void) setDelegate: (id)anObject;
/*
* NSCoding protocol
*/
- (void) encodeWithCoder: (NSCoder*)aCoder;
- (id) initWithCoder: (NSCoder*)aDecoder;
@end
@interface NSApplication (BackendMethods)
/* Set up the run loop input sources for a given mode */
- (void)setupRunLoopInputSourcesForMode:(NSString*)mode;
@end
@interface NSObject (NSServicesRequests)
// Pasteboard Read/Write
- (BOOL)readSelectionFromPasteboard:(NSPasteboard *)pboard;
- (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pboard
types:(NSArray *)types;
/*
* Pasteboard Read/Write
*/
- (BOOL) readSelectionFromPasteboard: (NSPasteboard*)pboard;
- (BOOL) writeSelectionToPasteboard: (NSPasteboard*)pboard
types: (NSArray*)types;
@end
@ -283,53 +258,87 @@ extern NSString *NSEventTrackingRunLoopMode;
/* Backend functions */
extern BOOL initialize_gnustep_backend (void);
#ifndef NO_GNUSTEP
/*
* A formal protocol that duplicates the informal protocol for delegates.
*/
@protocol GSAppDelegateProtocol
- (BOOL) application: (NSApplication*)app
openFileWithoutUI: (NSString*)filename;
- (BOOL) application: (NSApplication*)app
openFile: (NSString*)filename;
- (BOOL) application: (NSApplication*)app
openTempFile: (NSString*)filename;
- (void) applicationDidBecomeActive: (NSNotification*)aNotification;
- (void) applicationDidFinishLaunching: (NSNotification*)aNotification;
- (void) applicationDidHide: (NSNotification*)aNotification;
- (void) applicationDidResignActive: (NSNotification*)aNotification;
- (void) applicationDidUnhide: (NSNotification*)aNotification;
- (void) applicationDidUpdate: (NSNotification*)aNotification;
- (BOOL) applicationOpenUntitledFile: (NSApplication*)app;
- (BOOL) applicationShouldTerminate: (id)sender;
- (void) applicationWillBecomeActive: (NSNotification*)aNotification;
- (void) applicationWillFinishLaunching: (NSNotification*)aNotification;
- (void) applicationWillHide: (NSNotification*)aNotification;
- (void) applicationWillResignActive: (NSNotification*)aNotification;
- (void) applicationWillUnhide: (NSNotification*)aNotification;
- (void) applicationWillUpdate: (NSNotification*)aNotification;
@end
#endif
//
// Notifications
//
extern NSString *NSApplicationDidBecomeActiveNotification;
extern NSString *NSApplicationDidFinishLaunchingNotification;
extern NSString *NSApplicationDidHideNotification;
extern NSString *NSApplicationDidResignActiveNotification;
extern NSString *NSApplicationDidUnhideNotification;
extern NSString *NSApplicationDidUpdateNotification;
extern NSString *NSApplicationWillBecomeActiveNotification;
extern NSString *NSApplicationWillFinishLaunchingNotification;
extern NSString *NSApplicationWillTerminateNotification;
extern NSString *NSApplicationWillHideNotification;
extern NSString *NSApplicationWillResignActiveNotification;
extern NSString *NSApplicationWillUnhideNotification;
extern NSString *NSApplicationWillUpdateNotification;
/*
* Notifications
*/
extern NSString *NSApplicationDidBecomeActiveNotification;
extern NSString *NSApplicationDidFinishLaunchingNotification;
extern NSString *NSApplicationDidHideNotification;
extern NSString *NSApplicationDidResignActiveNotification;
extern NSString *NSApplicationDidUnhideNotification;
extern NSString *NSApplicationDidUpdateNotification;
extern NSString *NSApplicationWillBecomeActiveNotification;
extern NSString *NSApplicationWillFinishLaunchingNotification;
extern NSString *NSApplicationWillTerminateNotification;
extern NSString *NSApplicationWillHideNotification;
extern NSString *NSApplicationWillResignActiveNotification;
extern NSString *NSApplicationWillUnhideNotification;
extern NSString *NSApplicationWillUpdateNotification;
//
// Determine Whether an Item Is Included in Services Menus
//
int NSSetShowsServicesMenuItem(NSString *item, BOOL showService);
BOOL NSShowsServicesMenuItem(NSString *item);
/*
* Determine Whether an Item Is Included in Services Menus
*/
int
NSSetShowsServicesMenuItem(NSString *item, BOOL showService);
//
// Programmatically Invoke a Service
//
BOOL NSPerformService(NSString *item, NSPasteboard *pboard);
BOOL
NSShowsServicesMenuItem(NSString *item);
//
// Force Services Menu to Update Based on New Services
//
void NSUpdateDynamicServices(void);
/*
* Programmatically Invoke a Service
*/
BOOL
NSPerformService(NSString *item, NSPasteboard *pboard);
//
// Register object to handle services requests.
//
/*
* Force Services Menu to Update Based on New Services
*/
void
NSUpdateDynamicServices(void);
/*
* Register object to handle services requests.
*/
void
NSRegisterServicesProvider(id provider, NSString *name);
int NSApplicationMain(int argc, const char **argv);
int
NSApplicationMain(int argc, const char **argv);
NSString *NSOpenStepRootDirectory(void);
NSString*
NSOpenStepRootDirectory(void);
//
// The NSApp global variable.
//
extern NSApplication *NSApp;
/*
* The NSApp global variable.
*/
extern NSApplication *NSApp;
#endif // _GNUstep_H_NSApplication

View file

@ -201,11 +201,17 @@ NSApplication *NSApp = nil;
*/
if ((filePath = [defs stringForKey: @"GSFilePath"]) != nil)
{
[self application: self openFile: filePath];
if ([delegate respondsToSelector: @selector(application:openFile:)])
{
[delegate application: self openFile: filePath];
}
}
else if ((filePath = [defs stringForKey: @"GSTempPath"]) != nil)
{
[self application: self openTempFile: filePath];
if ([delegate respondsToSelector: @selector(application:openTempFile:)])
{
[delegate application: self openTempFile: filePath];
}
}
}
@ -575,34 +581,21 @@ NSApplication *NSApp = nil;
break;
}
case NSRightMouseDown:
if (main_menu)
{
static NSMenu *copyOfMainMenu = nil;
NSWindow *copyMenuWindow;
if (!copyOfMainMenu) /* display the menu under the mouse */
copyOfMainMenu = [main_menu copy];
copyMenuWindow = [copyOfMainMenu window];
[copyOfMainMenu _rightMouseDisplay];
[copyMenuWindow _captureMouse: self];
[[copyOfMainMenu menuView] mouseDown: theEvent];
[copyMenuWindow _releaseMouse: self];
}
break;
default: /* pass all other events to the event's window */
{
NSWindow* window = [theEvent window];
NSWindow *window = [theEvent window];
if (!theEvent)
NSDebugLog(@"NSEvent is nil!\n");
NSDebugLog(@"NSEvent type: %d", [theEvent type]);
NSDebugLog(@"send event to window");
NSDebugLog([window description]);
if (!window)
if (window)
[window sendEvent: theEvent];
else if ([theEvent type] == NSRightMouseDown)
[self rightMouseDown: theEvent];
else
NSDebugLog(@"no window");
[window sendEvent: theEvent];
}
}
}
@ -1343,7 +1336,7 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
}
if (changed)
{
[[item controlView] sizeToFit];
[(id)[item controlView] sizeToFit];
[menu sizeToFit];
[menu update];
}
@ -1413,7 +1406,11 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
*/
- (void) terminate: (id)sender
{
if ([self applicationShouldTerminate: self])
BOOL shouldTerminate = YES;
if ([delegate respondsToSelector: @selector(applicationShouldTerminate:)])
shouldTerminate = [delegate applicationShouldTerminate: sender];
if (shouldTerminate)
{
app_should_quit = YES;
/*
@ -1457,131 +1454,6 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
SET_DELEGATE_NOTIFICATION(WillUpdate);
}
/*
* Implemented by the delegate
*/
- (BOOL) application: sender openFileWithoutUI: (NSString *)filename
{
BOOL result = NO;
if ([delegate respondsToSelector: @selector(application:openFileWithoutUI:)])
result = [delegate application: sender openFileWithoutUI: filename];
return result;
}
- (BOOL) application: (NSApplication *)app openFile: (NSString *)filename
{
BOOL result = NO;
if ([delegate respondsToSelector: @selector(application:openFile:)])
result = [delegate application: app openFile: filename];
return result;
}
- (BOOL) application: (NSApplication *)app openTempFile: (NSString *)filename
{
BOOL result = NO;
if ([delegate respondsToSelector: @selector(application:openTempFile:)])
result = [delegate application: app openTempFile: filename];
return result;
}
- (void) applicationDidBecomeActive: (NSNotification *)aNotification
{
if ([delegate respondsToSelector: @selector(applicationDidBecomeActive:)])
[delegate applicationDidBecomeActive: aNotification];
}
- (void) applicationDidFinishLaunching: (NSNotification *)aNotification
{
if ([delegate respondsToSelector: @selector(applicationDidFinishLaunching:)])
[delegate applicationDidFinishLaunching: aNotification];
}
- (void) applicationDidHide: (NSNotification *)aNotification
{
if ([delegate respondsToSelector: @selector(applicationDidHide:)])
[delegate applicationDidHide: aNotification];
}
- (void) applicationDidResignActive: (NSNotification *)aNotification
{
if ([delegate respondsToSelector: @selector(applicationDidResignActive:)])
[delegate applicationDidResignActive: aNotification];
}
- (void) applicationDidUnhide: (NSNotification *)aNotification
{
if ([delegate respondsToSelector: @selector(applicationDidUnhide:)])
[delegate applicationDidUnhide: aNotification];
}
- (void) applicationDidUpdate: (NSNotification *)aNotification
{
if ([delegate respondsToSelector: @selector(applicationDidUpdate:)])
[delegate applicationDidUpdate: aNotification];
}
- (BOOL) applicationOpenUntitledFile: (NSApplication *)app
{
BOOL result = NO;
if ([delegate respondsToSelector: @selector(applicationOpenUntitledFile:)])
result = [delegate applicationOpenUntitledFile: app];
return result;
}
- (BOOL) applicationShouldTerminate: sender
{
BOOL result = YES;
if ([delegate respondsToSelector: @selector(applicationShouldTerminate:)])
result = [delegate applicationShouldTerminate: sender];
return result;
}
- (void) applicationWillBecomeActive: (NSNotification *)aNotification
{
if ([delegate respondsToSelector: @selector(applicationWillBecomeActive:)])
[delegate applicationWillBecomeActive: aNotification];
}
- (void) applicationWillFinishLaunching: (NSNotification *)aNotification
{
if ([delegate respondsToSelector: @selector(applicationWillFinishLaunching:)])
[delegate applicationWillFinishLaunching: aNotification];
}
- (void) applicationWillHide: (NSNotification *)aNotification
{
if ([delegate respondsToSelector: @selector(applicationWillHide:)])
[delegate applicationWillHide: aNotification];
}
- (void) applicationWillResignActive: (NSNotification *)aNotification
{
if ([delegate respondsToSelector: @selector(applicationWillResignActive:)])
[delegate applicationWillResignActive: aNotification];
}
- (void) applicationWillUnhide: (NSNotification *)aNotification
{
if ([delegate respondsToSelector: @selector(applicationWillUnhide:)])
[delegate applicationWillUnhide: aNotification];
}
- (void) applicationWillUpdate: (NSNotification *)aNotification
{
if ([delegate respondsToSelector: @selector(applicationWillUpdate:)])
[delegate applicationWillUpdate: aNotification];
}
/*
* NSCoding protocol
*/

View file

@ -29,6 +29,8 @@
#include <gnustep/gui/config.h>
#include <Foundation/NSCoder.h>
#include <AppKit/NSResponder.h>
#include <AppKit/NSApplication.h>
#include <AppKit/NSMenu.h>
#include <AppKit/NSGraphics.h>
#include <objc/objc.h>
@ -115,7 +117,7 @@
if (next_responder)
return [next_responder flagsChanged: theEvent];
else
return [self noResponderFor: @selector(flagsChanged: )];
return [self noResponderFor: @selector(flagsChanged:)];
}
- (void) helpRequested: (NSEvent *)theEvent
@ -123,7 +125,7 @@
if (next_responder)
return [next_responder helpRequested: theEvent];
else
return [self noResponderFor: @selector(helpRequested: )];
return [self noResponderFor: @selector(helpRequested:)];
}
- (void) keyDown: (NSEvent *)theEvent
@ -131,7 +133,7 @@
if (next_responder)
return [next_responder keyDown: theEvent];
else
return [self noResponderFor: @selector(keyDown: )];
return [self noResponderFor: @selector(keyDown:)];
}
- (void) keyUp: (NSEvent *)theEvent
@ -139,7 +141,7 @@
if (next_responder)
return [next_responder keyUp: theEvent];
else
return [self noResponderFor: @selector(keyUp: )];
return [self noResponderFor: @selector(keyUp:)];
}
- (void) mouseDown: (NSEvent *)theEvent
@ -147,7 +149,7 @@
if (next_responder)
return [next_responder mouseDown: theEvent];
else
return [self noResponderFor: @selector(mouseDown: )];
return [self noResponderFor: @selector(mouseDown:)];
}
- (void) mouseDragged: (NSEvent *)theEvent
@ -155,7 +157,7 @@
if (next_responder)
return [next_responder mouseDragged: theEvent];
else
return [self noResponderFor: @selector(mouseDragged: )];
return [self noResponderFor: @selector(mouseDragged:)];
}
- (void) mouseEntered: (NSEvent *)theEvent
@ -163,7 +165,7 @@
if (next_responder)
return [next_responder mouseEntered: theEvent];
else
return [self noResponderFor: @selector(mouseEntered: )];
return [self noResponderFor: @selector(mouseEntered:)];
}
- (void) mouseExited: (NSEvent *)theEvent
@ -171,7 +173,7 @@
if (next_responder)
return [next_responder mouseExited: theEvent];
else
return [self noResponderFor: @selector(mouseExited: )];
return [self noResponderFor: @selector(mouseExited:)];
}
- (void) mouseMoved: (NSEvent *)theEvent
@ -179,7 +181,7 @@
if (next_responder)
return [next_responder mouseMoved: theEvent];
else
return [self noResponderFor: @selector(mouseMoved: )];
return [self noResponderFor: @selector(mouseMoved:)];
}
- (void) mouseUp: (NSEvent *)theEvent
@ -187,13 +189,13 @@
if (next_responder)
return [next_responder mouseUp: theEvent];
else
return [self noResponderFor: @selector(mouseUp: )];
return [self noResponderFor: @selector(mouseUp:)];
}
- (void) noResponderFor: (SEL)eventSelector
{
/* Only beep for key down events */
if (sel_eq(eventSelector, @selector(keyDown: )))
if (sel_eq(eventSelector, @selector(keyDown:)))
NSBeep();
}
@ -202,7 +204,14 @@
if (next_responder)
return [next_responder rightMouseDown: theEvent];
else
return [self noResponderFor: @selector(rightMouseDown: )];
{
NSMenu *menu = [NSApp mainMenu];
if (menu)
[menu _rightMouseDisplay];
else
return [self noResponderFor: @selector(rightMouseDown:)];
}
}
- (void) rightMouseDragged: (NSEvent *)theEvent
@ -210,7 +219,7 @@
if (next_responder)
return [next_responder rightMouseDragged: theEvent];
else
return [self noResponderFor: @selector(rightMouseDragged: )];
return [self noResponderFor: @selector(rightMouseDragged:)];
}
- (void) rightMouseUp: (NSEvent *)theEvent
@ -218,7 +227,7 @@
if (next_responder)
return [next_responder rightMouseUp: theEvent];
else
return [self noResponderFor: @selector(rightMouseUp: )];
return [self noResponderFor: @selector(rightMouseUp:)];
}
/*