зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
f515b75348
Коммит
74f9930289
|
@ -19,7 +19,7 @@
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
* Joe Hewitt <hewitt@netscape.com> (Original Author)
|
* Joe Hewitt <hewitt@netscape.com> (Original Author)
|
||||||
* David Haas <haas@cae.wisc.edu>
|
* David Haas <haasd@cae.wisc.edu>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#import "CHAutoCompleteTextField.h"
|
#import "CHAutoCompleteTextField.h"
|
||||||
|
@ -34,6 +34,17 @@ static const int kMaxRows = 6;
|
||||||
static const int kFrameMargin = 1;
|
static const int kFrameMargin = 1;
|
||||||
static const int kEscapeKeyCode = 53;
|
static const int kEscapeKeyCode = 53;
|
||||||
|
|
||||||
|
@interface AutoCompleteWindow : NSWindow
|
||||||
|
- (BOOL)isKeyWindow;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation AutoCompleteWindow
|
||||||
|
- (BOOL)isKeyWindow
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
class AutoCompleteListener : public nsIAutoCompleteListener
|
class AutoCompleteListener : public nsIAutoCompleteListener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -95,8 +106,8 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
[self setSession:@"history"];
|
[self setSession:@"history"];
|
||||||
|
|
||||||
// construct and configure the popup window
|
// construct and configure the popup window
|
||||||
mPopupWin = [[[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,0,0)
|
mPopupWin = [[AutoCompleteWindow alloc] initWithContentRect:NSMakeRect(0,0,0,0)
|
||||||
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO] retain];
|
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
|
||||||
[mPopupWin setReleasedWhenClosed:NO];
|
[mPopupWin setReleasedWhenClosed:NO];
|
||||||
[mPopupWin setLevel:NSFloatingWindowLevel];
|
[mPopupWin setLevel:NSFloatingWindowLevel];
|
||||||
[mPopupWin setHasShadow:YES];
|
[mPopupWin setHasShadow:YES];
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
* Joe Hewitt <hewitt@netscape.com> (Original Author)
|
* Joe Hewitt <hewitt@netscape.com> (Original Author)
|
||||||
* David Haas <haas@cae.wisc.edu>
|
* David Haas <haasd@cae.wisc.edu>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#import "CHAutoCompleteTextField.h"
|
#import "CHAutoCompleteTextField.h"
|
||||||
|
@ -34,6 +34,17 @@ static const int kMaxRows = 6;
|
||||||
static const int kFrameMargin = 1;
|
static const int kFrameMargin = 1;
|
||||||
static const int kEscapeKeyCode = 53;
|
static const int kEscapeKeyCode = 53;
|
||||||
|
|
||||||
|
@interface AutoCompleteWindow : NSWindow
|
||||||
|
- (BOOL)isKeyWindow;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation AutoCompleteWindow
|
||||||
|
- (BOOL)isKeyWindow
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
class AutoCompleteListener : public nsIAutoCompleteListener
|
class AutoCompleteListener : public nsIAutoCompleteListener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -95,8 +106,8 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
[self setSession:@"history"];
|
[self setSession:@"history"];
|
||||||
|
|
||||||
// construct and configure the popup window
|
// construct and configure the popup window
|
||||||
mPopupWin = [[[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,0,0)
|
mPopupWin = [[AutoCompleteWindow alloc] initWithContentRect:NSMakeRect(0,0,0,0)
|
||||||
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO] retain];
|
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
|
||||||
[mPopupWin setReleasedWhenClosed:NO];
|
[mPopupWin setReleasedWhenClosed:NO];
|
||||||
[mPopupWin setLevel:NSFloatingWindowLevel];
|
[mPopupWin setLevel:NSFloatingWindowLevel];
|
||||||
[mPopupWin setHasShadow:YES];
|
[mPopupWin setHasShadow:YES];
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
* Joe Hewitt <hewitt@netscape.com> (Original Author)
|
* Joe Hewitt <hewitt@netscape.com> (Original Author)
|
||||||
* David Haas <haas@cae.wisc.edu>
|
* David Haas <haasd@cae.wisc.edu>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#import "CHAutoCompleteTextField.h"
|
#import "CHAutoCompleteTextField.h"
|
||||||
|
@ -34,6 +34,17 @@ static const int kMaxRows = 6;
|
||||||
static const int kFrameMargin = 1;
|
static const int kFrameMargin = 1;
|
||||||
static const int kEscapeKeyCode = 53;
|
static const int kEscapeKeyCode = 53;
|
||||||
|
|
||||||
|
@interface AutoCompleteWindow : NSWindow
|
||||||
|
- (BOOL)isKeyWindow;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation AutoCompleteWindow
|
||||||
|
- (BOOL)isKeyWindow
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
class AutoCompleteListener : public nsIAutoCompleteListener
|
class AutoCompleteListener : public nsIAutoCompleteListener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -95,8 +106,8 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
[self setSession:@"history"];
|
[self setSession:@"history"];
|
||||||
|
|
||||||
// construct and configure the popup window
|
// construct and configure the popup window
|
||||||
mPopupWin = [[[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,0,0)
|
mPopupWin = [[AutoCompleteWindow alloc] initWithContentRect:NSMakeRect(0,0,0,0)
|
||||||
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO] retain];
|
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
|
||||||
[mPopupWin setReleasedWhenClosed:NO];
|
[mPopupWin setReleasedWhenClosed:NO];
|
||||||
[mPopupWin setLevel:NSFloatingWindowLevel];
|
[mPopupWin setLevel:NSFloatingWindowLevel];
|
||||||
[mPopupWin setHasShadow:YES];
|
[mPopupWin setHasShadow:YES];
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
* Joe Hewitt <hewitt@netscape.com> (Original Author)
|
* Joe Hewitt <hewitt@netscape.com> (Original Author)
|
||||||
* David Haas <haas@cae.wisc.edu>
|
* David Haas <haasd@cae.wisc.edu>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#import "CHAutoCompleteTextField.h"
|
#import "CHAutoCompleteTextField.h"
|
||||||
|
@ -34,6 +34,17 @@ static const int kMaxRows = 6;
|
||||||
static const int kFrameMargin = 1;
|
static const int kFrameMargin = 1;
|
||||||
static const int kEscapeKeyCode = 53;
|
static const int kEscapeKeyCode = 53;
|
||||||
|
|
||||||
|
@interface AutoCompleteWindow : NSWindow
|
||||||
|
- (BOOL)isKeyWindow;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation AutoCompleteWindow
|
||||||
|
- (BOOL)isKeyWindow
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
class AutoCompleteListener : public nsIAutoCompleteListener
|
class AutoCompleteListener : public nsIAutoCompleteListener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -95,8 +106,8 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
||||||
[self setSession:@"history"];
|
[self setSession:@"history"];
|
||||||
|
|
||||||
// construct and configure the popup window
|
// construct and configure the popup window
|
||||||
mPopupWin = [[[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,0,0)
|
mPopupWin = [[AutoCompleteWindow alloc] initWithContentRect:NSMakeRect(0,0,0,0)
|
||||||
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO] retain];
|
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
|
||||||
[mPopupWin setReleasedWhenClosed:NO];
|
[mPopupWin setReleasedWhenClosed:NO];
|
||||||
[mPopupWin setLevel:NSFloatingWindowLevel];
|
[mPopupWin setLevel:NSFloatingWindowLevel];
|
||||||
[mPopupWin setHasShadow:YES];
|
[mPopupWin setHasShadow:YES];
|
||||||
|
|
Загрузка…
Ссылка в новой задаче