use a new window subclass that lies about it being the key window so the

scrollbar of the autocomplete popup is always enabled. also fixes a
memory leak where we'd leak the autocomplete popup in every window (bug 157637)
This commit is contained in:
pinkerton%netscape.com 2002-08-09 15:33:29 +00:00
Родитель f515b75348
Коммит 74f9930289
4 изменённых файлов: 56 добавлений и 12 удалений

Просмотреть файл

@ -19,7 +19,7 @@
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (Original Author)
* David Haas <haas@cae.wisc.edu>
* David Haas <haasd@cae.wisc.edu>
*/
#import "CHAutoCompleteTextField.h"
@ -34,6 +34,17 @@ static const int kMaxRows = 6;
static const int kFrameMargin = 1;
static const int kEscapeKeyCode = 53;
@interface AutoCompleteWindow : NSWindow
- (BOOL)isKeyWindow;
@end
@implementation AutoCompleteWindow
- (BOOL)isKeyWindow
{
return YES;
}
@end
class AutoCompleteListener : public nsIAutoCompleteListener
{
public:
@ -95,8 +106,8 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
[self setSession:@"history"];
// construct and configure the popup window
mPopupWin = [[[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,0,0)
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO] retain];
mPopupWin = [[AutoCompleteWindow alloc] initWithContentRect:NSMakeRect(0,0,0,0)
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
[mPopupWin setReleasedWhenClosed:NO];
[mPopupWin setLevel:NSFloatingWindowLevel];
[mPopupWin setHasShadow:YES];

Просмотреть файл

@ -19,7 +19,7 @@
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (Original Author)
* David Haas <haas@cae.wisc.edu>
* David Haas <haasd@cae.wisc.edu>
*/
#import "CHAutoCompleteTextField.h"
@ -34,6 +34,17 @@ static const int kMaxRows = 6;
static const int kFrameMargin = 1;
static const int kEscapeKeyCode = 53;
@interface AutoCompleteWindow : NSWindow
- (BOOL)isKeyWindow;
@end
@implementation AutoCompleteWindow
- (BOOL)isKeyWindow
{
return YES;
}
@end
class AutoCompleteListener : public nsIAutoCompleteListener
{
public:
@ -95,8 +106,8 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
[self setSession:@"history"];
// construct and configure the popup window
mPopupWin = [[[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,0,0)
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO] retain];
mPopupWin = [[AutoCompleteWindow alloc] initWithContentRect:NSMakeRect(0,0,0,0)
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
[mPopupWin setReleasedWhenClosed:NO];
[mPopupWin setLevel:NSFloatingWindowLevel];
[mPopupWin setHasShadow:YES];

Просмотреть файл

@ -19,7 +19,7 @@
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (Original Author)
* David Haas <haas@cae.wisc.edu>
* David Haas <haasd@cae.wisc.edu>
*/
#import "CHAutoCompleteTextField.h"
@ -34,6 +34,17 @@ static const int kMaxRows = 6;
static const int kFrameMargin = 1;
static const int kEscapeKeyCode = 53;
@interface AutoCompleteWindow : NSWindow
- (BOOL)isKeyWindow;
@end
@implementation AutoCompleteWindow
- (BOOL)isKeyWindow
{
return YES;
}
@end
class AutoCompleteListener : public nsIAutoCompleteListener
{
public:
@ -95,8 +106,8 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
[self setSession:@"history"];
// construct and configure the popup window
mPopupWin = [[[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,0,0)
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO] retain];
mPopupWin = [[AutoCompleteWindow alloc] initWithContentRect:NSMakeRect(0,0,0,0)
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
[mPopupWin setReleasedWhenClosed:NO];
[mPopupWin setLevel:NSFloatingWindowLevel];
[mPopupWin setHasShadow:YES];

Просмотреть файл

@ -19,7 +19,7 @@
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com> (Original Author)
* David Haas <haas@cae.wisc.edu>
* David Haas <haasd@cae.wisc.edu>
*/
#import "CHAutoCompleteTextField.h"
@ -34,6 +34,17 @@ static const int kMaxRows = 6;
static const int kFrameMargin = 1;
static const int kEscapeKeyCode = 53;
@interface AutoCompleteWindow : NSWindow
- (BOOL)isKeyWindow;
@end
@implementation AutoCompleteWindow
- (BOOL)isKeyWindow
{
return YES;
}
@end
class AutoCompleteListener : public nsIAutoCompleteListener
{
public:
@ -95,8 +106,8 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
[self setSession:@"history"];
// construct and configure the popup window
mPopupWin = [[[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,0,0)
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO] retain];
mPopupWin = [[AutoCompleteWindow alloc] initWithContentRect:NSMakeRect(0,0,0,0)
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
[mPopupWin setReleasedWhenClosed:NO];
[mPopupWin setLevel:NSFloatingWindowLevel];
[mPopupWin setHasShadow:YES];