Added shortcuts Cmd-Left/Right for going back/forward.

git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@263 94f232f2-1747-11df-bad5-a5bfde151594
This commit is contained in:
stippi
2012-07-03 15:30:48 +02:00
committed by Alexandre Deckner
parent 85fc02b33d
commit ea77068a8e
+22 -15
View File
@@ -281,21 +281,28 @@ BrowserWindow::~BrowserWindow()
void void
BrowserWindow::DispatchMessage(BMessage* message, BHandler* target) BrowserWindow::DispatchMessage(BMessage* message, BHandler* target)
{ {
if (fURLTextControl && message->what == B_KEY_DOWN const char* bytes;
&& target == fURLTextControl->TextView()) { int32 modifiers;
// Handle B_RETURN in the URL text control. This is the easiest if ((message->what == B_KEY_DOWN || message->what == B_UNMAPPED_KEY_DOWN)
// way to react *only* when the user presses the return key in the && message->FindString("bytes", &bytes) == B_OK
// address bar, as opposed to trying to load whatever is in there when && message->FindInt32("modifiers", &modifiers) == B_OK) {
// the text control just goes out of focus. if (fURLTextControl && target == fURLTextControl->TextView()) {
const char* bytes; // Handle B_RETURN in the URL text control. This is the easiest
if (message->FindString("bytes", &bytes) == B_OK // way to react *only* when the user presses the return key in the
&& bytes[0] == B_RETURN) { // address bar, as opposed to trying to load whatever is in there when
// Do it in such a way that the user sees the Go-button go down. // the text control just goes out of focus.
fGoButton->SetValue(B_CONTROL_ON); if (bytes[0] == B_RETURN) {
UpdateIfNeeded(); // Do it in such a way that the user sees the Go-button go down.
fGoButton->Invoke(); fGoButton->SetValue(B_CONTROL_ON);
snooze(1000); UpdateIfNeeded();
fGoButton->SetValue(B_CONTROL_OFF); fGoButton->Invoke();
snooze(1000);
fGoButton->SetValue(B_CONTROL_OFF);
}
} else if (bytes[0] == B_LEFT_ARROW && (modifiers & B_COMMAND_KEY) != 0) {
PostMessage(GO_BACK);
} else if (bytes[0] == B_RIGHT_ARROW && (modifiers & B_COMMAND_KEY) != 0) {
PostMessage(GO_FORWARD);
} }
} }
BWebWindow::DispatchMessage(message, target); BWebWindow::DispatchMessage(message, target);