Mostly revert r563 and fix it properly. The ESC key should be dispatched to the
text view from the filter as well as from the browser window. git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@564 94f232f2-1747-11df-bad5-a5bfde151594
This commit is contained in:
parent
a9112961b9
commit
a65490807d
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2007 Andrea Anzani <andrea.anzani@gmail.com>
|
||||
* Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com>
|
||||
* Copyright (C) 2007, 2010 Ryan Leavengood <leavengood@gmail.com>
|
||||
* Copyright (C) 2009 Maxime Simon <simon.maxime@gmail.com>
|
||||
* Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de>
|
||||
* Copyright (C) 2010 Michael Lotz <mmlr@mlotz.ch>
|
||||
@ -546,8 +546,12 @@ BrowserWindow::DispatchMessage(BMessage* message, BHandler* target)
|
||||
PostMessage(GO_FORWARD);
|
||||
return;
|
||||
} else if (bytes[0] == B_ESCAPE) {
|
||||
PostMessage(STOP);
|
||||
return;
|
||||
// Let the URL input handle escape when it is the target
|
||||
if (target != fURLInputGroup->TextView()) {
|
||||
// Otherwise do a stop
|
||||
PostMessage(STOP);
|
||||
return;
|
||||
}
|
||||
} else if (bytes[0] == B_FUNCTION_KEY) {
|
||||
// Some function key Firefox compatibility
|
||||
int32 key;
|
||||
|
@ -73,8 +73,7 @@ TextViewCompleter::TextViewCompleter(BTextView* textView, ChoiceModel* model,
|
||||
new BDefaultChoiceView(), patternSelector),
|
||||
BMessageFilter(B_KEY_DOWN),
|
||||
fTextView(textView),
|
||||
fModificationsReported(false),
|
||||
fOriginalTextSaved(false)
|
||||
fModificationsReported(false)
|
||||
{
|
||||
fTextView->AddFilter(this);
|
||||
}
|
||||
@ -103,11 +102,6 @@ TextViewCompleter::TextModified(bool updateChoices)
|
||||
filter_result
|
||||
TextViewCompleter::Filter(BMessage* message, BHandler** target)
|
||||
{
|
||||
if (!fOriginalTextSaved) {
|
||||
fOriginalText = fTextView->Text();
|
||||
fOriginalTextSaved = true;
|
||||
}
|
||||
|
||||
const char* bytes;
|
||||
int32 modifiers;
|
||||
if (!target || message->FindString("bytes", &bytes) != B_OK
|
||||
@ -146,14 +140,8 @@ TextViewCompleter::Filter(BMessage* message, BHandler** target)
|
||||
}
|
||||
|
||||
case B_ESCAPE:
|
||||
if (fOriginalText != fTextView->Text()) {
|
||||
fModificationsReported = false;
|
||||
fTextView->SetText(fOriginalText.String());
|
||||
fTextView->SelectAll();
|
||||
fModificationsReported = true;
|
||||
CancelChoice();
|
||||
}
|
||||
return B_SKIP_MESSAGE;
|
||||
CancelChoice();
|
||||
return B_DISPATCH_MESSAGE;
|
||||
case B_RETURN:
|
||||
if (IsChoiceSelected()) {
|
||||
ApplyChoice();
|
||||
|
@ -43,8 +43,6 @@ private:
|
||||
private:
|
||||
BTextView* fTextView;
|
||||
bool fModificationsReported;
|
||||
BString fOriginalText;
|
||||
bool fOriginalTextSaved;
|
||||
};
|
||||
|
||||
#endif // TEXT_CONTROL_COMPLETER_H
|
||||
|
Loading…
Reference in New Issue
Block a user