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 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) 2009 Maxime Simon <simon.maxime@gmail.com>
|
||||||
* Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de>
|
* Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de>
|
||||||
* Copyright (C) 2010 Michael Lotz <mmlr@mlotz.ch>
|
* Copyright (C) 2010 Michael Lotz <mmlr@mlotz.ch>
|
||||||
@ -546,8 +546,12 @@ BrowserWindow::DispatchMessage(BMessage* message, BHandler* target)
|
|||||||
PostMessage(GO_FORWARD);
|
PostMessage(GO_FORWARD);
|
||||||
return;
|
return;
|
||||||
} else if (bytes[0] == B_ESCAPE) {
|
} else if (bytes[0] == B_ESCAPE) {
|
||||||
|
// Let the URL input handle escape when it is the target
|
||||||
|
if (target != fURLInputGroup->TextView()) {
|
||||||
|
// Otherwise do a stop
|
||||||
PostMessage(STOP);
|
PostMessage(STOP);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
} else if (bytes[0] == B_FUNCTION_KEY) {
|
} else if (bytes[0] == B_FUNCTION_KEY) {
|
||||||
// Some function key Firefox compatibility
|
// Some function key Firefox compatibility
|
||||||
int32 key;
|
int32 key;
|
||||||
|
@ -73,8 +73,7 @@ TextViewCompleter::TextViewCompleter(BTextView* textView, ChoiceModel* model,
|
|||||||
new BDefaultChoiceView(), patternSelector),
|
new BDefaultChoiceView(), patternSelector),
|
||||||
BMessageFilter(B_KEY_DOWN),
|
BMessageFilter(B_KEY_DOWN),
|
||||||
fTextView(textView),
|
fTextView(textView),
|
||||||
fModificationsReported(false),
|
fModificationsReported(false)
|
||||||
fOriginalTextSaved(false)
|
|
||||||
{
|
{
|
||||||
fTextView->AddFilter(this);
|
fTextView->AddFilter(this);
|
||||||
}
|
}
|
||||||
@ -103,11 +102,6 @@ TextViewCompleter::TextModified(bool updateChoices)
|
|||||||
filter_result
|
filter_result
|
||||||
TextViewCompleter::Filter(BMessage* message, BHandler** target)
|
TextViewCompleter::Filter(BMessage* message, BHandler** target)
|
||||||
{
|
{
|
||||||
if (!fOriginalTextSaved) {
|
|
||||||
fOriginalText = fTextView->Text();
|
|
||||||
fOriginalTextSaved = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* bytes;
|
const char* bytes;
|
||||||
int32 modifiers;
|
int32 modifiers;
|
||||||
if (!target || message->FindString("bytes", &bytes) != B_OK
|
if (!target || message->FindString("bytes", &bytes) != B_OK
|
||||||
@ -146,14 +140,8 @@ TextViewCompleter::Filter(BMessage* message, BHandler** target)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case B_ESCAPE:
|
case B_ESCAPE:
|
||||||
if (fOriginalText != fTextView->Text()) {
|
|
||||||
fModificationsReported = false;
|
|
||||||
fTextView->SetText(fOriginalText.String());
|
|
||||||
fTextView->SelectAll();
|
|
||||||
fModificationsReported = true;
|
|
||||||
CancelChoice();
|
CancelChoice();
|
||||||
}
|
return B_DISPATCH_MESSAGE;
|
||||||
return B_SKIP_MESSAGE;
|
|
||||||
case B_RETURN:
|
case B_RETURN:
|
||||||
if (IsChoiceSelected()) {
|
if (IsChoiceSelected()) {
|
||||||
ApplyChoice();
|
ApplyChoice();
|
||||||
|
@ -43,8 +43,6 @@ private:
|
|||||||
private:
|
private:
|
||||||
BTextView* fTextView;
|
BTextView* fTextView;
|
||||||
bool fModificationsReported;
|
bool fModificationsReported;
|
||||||
BString fOriginalText;
|
|
||||||
bool fOriginalTextSaved;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TEXT_CONTROL_COMPLETER_H
|
#endif // TEXT_CONTROL_COMPLETER_H
|
||||||
|
Loading…
Reference in New Issue
Block a user