Implement activate and deactivate events for chimera (bug 157648). r=sfraser.

This commit is contained in:
bryner%netscape.com 2002-07-16 22:55:36 +00:00
parent f84fcb05fc
commit ffb06f8e7f
16 changed files with 180 additions and 0 deletions

View File

@ -6,4 +6,6 @@
{
IBOutlet id mAutoCompleteTextField;
}
-(BOOL) makeFirstResponder:(NSResponder*) responder;
@end

View File

@ -1,5 +1,6 @@
#import "BrowserWindow.h"
#import "CHAutoCompleteTextField.h"
#import "BrowserWindowController.h"
static const int kEscapeKeyCode = 53;
@ -19,4 +20,13 @@ static const int kEscapeKeyCode = 53;
[super sendEvent:theEvent];
}
- (BOOL)makeFirstResponder:(NSResponder*)responder
{
NSResponder* oldResponder = [self firstResponder];
BOOL madeFirstResponder = [super makeFirstResponder:responder];
if (madeFirstResponder && oldResponder != [self firstResponder])
[(BrowserWindowController*)[self delegate] focusChangedFrom:oldResponder to:[self firstResponder]];
return madeFirstResponder;
}
@end

View File

@ -248,6 +248,12 @@ class nsIDOMNode;
- (CHBookmarksToolbar*) bookmarksToolbar;
- (BOOL) isResponderGeckoView:(NSResponder*) responder;
// called when the internal window focus has changed
// this allows us to dispatch activate and deactivate events as necessary
- (void) focusChangedFrom:(NSResponder*) oldResponder to:(NSResponder*) newResponder;
// Called to get cached versions of our security icons
+ (NSImage*) insecureIcon;
+ (NSImage*) secureIcon;

View File

@ -100,6 +100,12 @@ static NSArray* sToolbarDefaults = nil;
mModalSession = nil;
}
- (BOOL)isResponderGeckoView:(NSResponder*) responder
{
return ([responder isKindOfClass:[NSView class]] &&
[(NSView*)responder isDescendantOf:[mBrowserView getBrowserView]]);
}
- (void)windowDidBecomeKey:(NSNotification *)notification
{
BOOL windowWithMultipleTabs = ([mTabBrowser numberOfTabViewItems] > 1);
@ -107,6 +113,12 @@ static NSArray* sToolbarDefaults = nil;
// on whether we have multiple tabs
[[NSApp delegate] adjustCloseTabMenuItemKeyEquivalent:windowWithMultipleTabs];
[[NSApp delegate] adjustCloseWindowMenuItemKeyEquivalent:windowWithMultipleTabs];
if ([self isResponderGeckoView:[[self window] firstResponder]]) {
CHBrowserView* browserView = [mBrowserView getBrowserView];
if (browserView)
[browserView setActive:YES];
}
}
- (void)windowDidResignKey:(NSNotification *)notification
@ -115,6 +127,12 @@ static NSArray* sToolbarDefaults = nil;
// to Command-W, for other windows.
[[NSApp delegate] adjustCloseTabMenuItemKeyEquivalent:NO];
[[NSApp delegate] adjustCloseWindowMenuItemKeyEquivalent:NO];
if ([self isResponderGeckoView:[[self window] firstResponder]]) {
CHBrowserView* browserView = [mBrowserView getBrowserView];
if (browserView)
[browserView setActive:NO];
}
}
- (void)windowDidBecomeMain:(NSNotification *)notification
@ -1403,6 +1421,15 @@ static NSArray* sToolbarDefaults = nil;
return sBrokenIcon;
}
- (void) focusChangedFrom:(NSResponder*) oldResponder to:(NSResponder*) newResponder
{
BOOL oldResponderIsGecko = [self isResponderGeckoView:oldResponder];
BOOL newResponderIsGecko = [self isResponderGeckoView:newResponder];
if (oldResponderIsGecko != newResponderIsGecko)
[[mBrowserView getBrowserView] setActive:newResponderIsGecko];
}
@end

View File

@ -6,4 +6,6 @@
{
IBOutlet id mAutoCompleteTextField;
}
-(BOOL) makeFirstResponder:(NSResponder*) responder;
@end

View File

@ -1,5 +1,6 @@
#import "BrowserWindow.h"
#import "CHAutoCompleteTextField.h"
#import "BrowserWindowController.h"
static const int kEscapeKeyCode = 53;
@ -19,4 +20,13 @@ static const int kEscapeKeyCode = 53;
[super sendEvent:theEvent];
}
- (BOOL)makeFirstResponder:(NSResponder*)responder
{
NSResponder* oldResponder = [self firstResponder];
BOOL madeFirstResponder = [super makeFirstResponder:responder];
if (madeFirstResponder && oldResponder != [self firstResponder])
[(BrowserWindowController*)[self delegate] focusChangedFrom:oldResponder to:[self firstResponder]];
return madeFirstResponder;
}
@end

View File

@ -248,6 +248,12 @@ class nsIDOMNode;
- (CHBookmarksToolbar*) bookmarksToolbar;
- (BOOL) isResponderGeckoView:(NSResponder*) responder;
// called when the internal window focus has changed
// this allows us to dispatch activate and deactivate events as necessary
- (void) focusChangedFrom:(NSResponder*) oldResponder to:(NSResponder*) newResponder;
// Called to get cached versions of our security icons
+ (NSImage*) insecureIcon;
+ (NSImage*) secureIcon;

View File

@ -100,6 +100,12 @@ static NSArray* sToolbarDefaults = nil;
mModalSession = nil;
}
- (BOOL)isResponderGeckoView:(NSResponder*) responder
{
return ([responder isKindOfClass:[NSView class]] &&
[(NSView*)responder isDescendantOf:[mBrowserView getBrowserView]]);
}
- (void)windowDidBecomeKey:(NSNotification *)notification
{
BOOL windowWithMultipleTabs = ([mTabBrowser numberOfTabViewItems] > 1);
@ -107,6 +113,12 @@ static NSArray* sToolbarDefaults = nil;
// on whether we have multiple tabs
[[NSApp delegate] adjustCloseTabMenuItemKeyEquivalent:windowWithMultipleTabs];
[[NSApp delegate] adjustCloseWindowMenuItemKeyEquivalent:windowWithMultipleTabs];
if ([self isResponderGeckoView:[[self window] firstResponder]]) {
CHBrowserView* browserView = [mBrowserView getBrowserView];
if (browserView)
[browserView setActive:YES];
}
}
- (void)windowDidResignKey:(NSNotification *)notification
@ -115,6 +127,12 @@ static NSArray* sToolbarDefaults = nil;
// to Command-W, for other windows.
[[NSApp delegate] adjustCloseTabMenuItemKeyEquivalent:NO];
[[NSApp delegate] adjustCloseWindowMenuItemKeyEquivalent:NO];
if ([self isResponderGeckoView:[[self window] firstResponder]]) {
CHBrowserView* browserView = [mBrowserView getBrowserView];
if (browserView)
[browserView setActive:NO];
}
}
- (void)windowDidBecomeMain:(NSNotification *)notification
@ -1403,6 +1421,15 @@ static NSArray* sToolbarDefaults = nil;
return sBrokenIcon;
}
- (void) focusChangedFrom:(NSResponder*) oldResponder to:(NSResponder*) newResponder
{
BOOL oldResponderIsGecko = [self isResponderGeckoView:oldResponder];
BOOL newResponderIsGecko = [self isResponderGeckoView:newResponder];
if (oldResponderIsGecko != newResponderIsGecko)
[[mBrowserView getBrowserView] setActive:newResponderIsGecko];
}
@end

View File

@ -6,4 +6,6 @@
{
IBOutlet id mAutoCompleteTextField;
}
-(BOOL) makeFirstResponder:(NSResponder*) responder;
@end

View File

@ -1,5 +1,6 @@
#import "BrowserWindow.h"
#import "CHAutoCompleteTextField.h"
#import "BrowserWindowController.h"
static const int kEscapeKeyCode = 53;
@ -19,4 +20,13 @@ static const int kEscapeKeyCode = 53;
[super sendEvent:theEvent];
}
- (BOOL)makeFirstResponder:(NSResponder*)responder
{
NSResponder* oldResponder = [self firstResponder];
BOOL madeFirstResponder = [super makeFirstResponder:responder];
if (madeFirstResponder && oldResponder != [self firstResponder])
[(BrowserWindowController*)[self delegate] focusChangedFrom:oldResponder to:[self firstResponder]];
return madeFirstResponder;
}
@end

View File

@ -248,6 +248,12 @@ class nsIDOMNode;
- (CHBookmarksToolbar*) bookmarksToolbar;
- (BOOL) isResponderGeckoView:(NSResponder*) responder;
// called when the internal window focus has changed
// this allows us to dispatch activate and deactivate events as necessary
- (void) focusChangedFrom:(NSResponder*) oldResponder to:(NSResponder*) newResponder;
// Called to get cached versions of our security icons
+ (NSImage*) insecureIcon;
+ (NSImage*) secureIcon;

View File

@ -100,6 +100,12 @@ static NSArray* sToolbarDefaults = nil;
mModalSession = nil;
}
- (BOOL)isResponderGeckoView:(NSResponder*) responder
{
return ([responder isKindOfClass:[NSView class]] &&
[(NSView*)responder isDescendantOf:[mBrowserView getBrowserView]]);
}
- (void)windowDidBecomeKey:(NSNotification *)notification
{
BOOL windowWithMultipleTabs = ([mTabBrowser numberOfTabViewItems] > 1);
@ -107,6 +113,12 @@ static NSArray* sToolbarDefaults = nil;
// on whether we have multiple tabs
[[NSApp delegate] adjustCloseTabMenuItemKeyEquivalent:windowWithMultipleTabs];
[[NSApp delegate] adjustCloseWindowMenuItemKeyEquivalent:windowWithMultipleTabs];
if ([self isResponderGeckoView:[[self window] firstResponder]]) {
CHBrowserView* browserView = [mBrowserView getBrowserView];
if (browserView)
[browserView setActive:YES];
}
}
- (void)windowDidResignKey:(NSNotification *)notification
@ -115,6 +127,12 @@ static NSArray* sToolbarDefaults = nil;
// to Command-W, for other windows.
[[NSApp delegate] adjustCloseTabMenuItemKeyEquivalent:NO];
[[NSApp delegate] adjustCloseWindowMenuItemKeyEquivalent:NO];
if ([self isResponderGeckoView:[[self window] firstResponder]]) {
CHBrowserView* browserView = [mBrowserView getBrowserView];
if (browserView)
[browserView setActive:NO];
}
}
- (void)windowDidBecomeMain:(NSNotification *)notification
@ -1403,6 +1421,15 @@ static NSArray* sToolbarDefaults = nil;
return sBrokenIcon;
}
- (void) focusChangedFrom:(NSResponder*) oldResponder to:(NSResponder*) newResponder
{
BOOL oldResponderIsGecko = [self isResponderGeckoView:oldResponder];
BOOL newResponderIsGecko = [self isResponderGeckoView:newResponder];
if (oldResponderIsGecko != newResponderIsGecko)
[[mBrowserView getBrowserView] setActive:newResponderIsGecko];
}
@end

View File

@ -6,4 +6,6 @@
{
IBOutlet id mAutoCompleteTextField;
}
-(BOOL) makeFirstResponder:(NSResponder*) responder;
@end

View File

@ -1,5 +1,6 @@
#import "BrowserWindow.h"
#import "CHAutoCompleteTextField.h"
#import "BrowserWindowController.h"
static const int kEscapeKeyCode = 53;
@ -19,4 +20,13 @@ static const int kEscapeKeyCode = 53;
[super sendEvent:theEvent];
}
- (BOOL)makeFirstResponder:(NSResponder*)responder
{
NSResponder* oldResponder = [self firstResponder];
BOOL madeFirstResponder = [super makeFirstResponder:responder];
if (madeFirstResponder && oldResponder != [self firstResponder])
[(BrowserWindowController*)[self delegate] focusChangedFrom:oldResponder to:[self firstResponder]];
return madeFirstResponder;
}
@end

View File

@ -248,6 +248,12 @@ class nsIDOMNode;
- (CHBookmarksToolbar*) bookmarksToolbar;
- (BOOL) isResponderGeckoView:(NSResponder*) responder;
// called when the internal window focus has changed
// this allows us to dispatch activate and deactivate events as necessary
- (void) focusChangedFrom:(NSResponder*) oldResponder to:(NSResponder*) newResponder;
// Called to get cached versions of our security icons
+ (NSImage*) insecureIcon;
+ (NSImage*) secureIcon;

View File

@ -100,6 +100,12 @@ static NSArray* sToolbarDefaults = nil;
mModalSession = nil;
}
- (BOOL)isResponderGeckoView:(NSResponder*) responder
{
return ([responder isKindOfClass:[NSView class]] &&
[(NSView*)responder isDescendantOf:[mBrowserView getBrowserView]]);
}
- (void)windowDidBecomeKey:(NSNotification *)notification
{
BOOL windowWithMultipleTabs = ([mTabBrowser numberOfTabViewItems] > 1);
@ -107,6 +113,12 @@ static NSArray* sToolbarDefaults = nil;
// on whether we have multiple tabs
[[NSApp delegate] adjustCloseTabMenuItemKeyEquivalent:windowWithMultipleTabs];
[[NSApp delegate] adjustCloseWindowMenuItemKeyEquivalent:windowWithMultipleTabs];
if ([self isResponderGeckoView:[[self window] firstResponder]]) {
CHBrowserView* browserView = [mBrowserView getBrowserView];
if (browserView)
[browserView setActive:YES];
}
}
- (void)windowDidResignKey:(NSNotification *)notification
@ -115,6 +127,12 @@ static NSArray* sToolbarDefaults = nil;
// to Command-W, for other windows.
[[NSApp delegate] adjustCloseTabMenuItemKeyEquivalent:NO];
[[NSApp delegate] adjustCloseWindowMenuItemKeyEquivalent:NO];
if ([self isResponderGeckoView:[[self window] firstResponder]]) {
CHBrowserView* browserView = [mBrowserView getBrowserView];
if (browserView)
[browserView setActive:NO];
}
}
- (void)windowDidBecomeMain:(NSNotification *)notification
@ -1403,6 +1421,15 @@ static NSArray* sToolbarDefaults = nil;
return sBrokenIcon;
}
- (void) focusChangedFrom:(NSResponder*) oldResponder to:(NSResponder*) newResponder
{
BOOL oldResponderIsGecko = [self isResponderGeckoView:oldResponder];
BOOL newResponderIsGecko = [self isResponderGeckoView:newResponder];
if (oldResponderIsGecko != newResponderIsGecko)
[[mBrowserView getBrowserView] setActive:newResponderIsGecko];
}
@end