Middle clicking links will open new tabs, but will not select them. Matches

Firefox behavior.


git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@161 94f232f2-1747-11df-bad5-a5bfde151594
This commit is contained in:
stippi
2010-02-21 13:20:57 +00:00
parent 56bdbcc74e
commit 63d76ab872
4 changed files with 25 additions and 17 deletions
+5 -6
View File
@@ -171,7 +171,9 @@ void LauncherApp::MessageReceived(BMessage* message)
break;
BString url;
message->FindString("url", &url);
newTab(window, url);
bool select = false;
message->FindBool("select", &select);
newTab(window, url, select);
break;
}
case WINDOW_OPENED:
@@ -279,15 +281,12 @@ void LauncherApp::newWindow(const BString& url)
window->currentWebView()->loadRequest(url.String());
}
void LauncherApp::newTab(LauncherWindow* window, const BString& url)
void LauncherApp::newTab(LauncherWindow* window, const BString& url, bool select)
{
if (!window->Lock())
return;
window->newTab();
window->newTab(url, select);
window->Unlock();
if (url.Length())
window->currentWebView()->loadRequest(url.String());
}
// #pragma mark -
+1 -1
View File
@@ -51,7 +51,7 @@ public:
private:
bool openSettingsFile(BFile& file, uint32 mode);
void newWindow(const BString& url);
void newTab(LauncherWindow* window, const BString& url);
void newTab(LauncherWindow* window, const BString& url, bool select);
int m_windowCount;
BRect m_lastWindowFrame;
+18 -9
View File
@@ -226,7 +226,7 @@ LauncherWindow::LauncherWindow(BRect frame, const BMessenger& downloadListener,
);
}
newTab();
newTab("", true);
currentWebView()->webPage()->SetDownloadListener(downloadListener);
m_findGroup->SetVisible(false);
@@ -406,17 +406,23 @@ void LauncherWindow::MenusBeginning()
history->Unlock();
}
void LauncherWindow::newTab()
void LauncherWindow::newTab(const BString& url, bool select)
{
// Executed in app thread (new BWebPage needs to be created in app thread).
WebView* webView = new WebView("web_view");
m_tabView->AddTab(webView);
m_tabView->TabAt(m_tabView->CountTabs() - 1)->SetLabel("New tab");
m_tabView->Select(m_tabView->CountTabs() - 1);
setCurrentWebView(webView);
navigationCapabilitiesChanged(false, false, false, webView);
if (m_url)
m_url->MakeFocus(true);
if (url.Length())
webView->loadRequest(url.String());
if (select) {
m_tabView->Select(m_tabView->CountTabs() - 1);
setCurrentWebView(webView);
navigationCapabilitiesChanged(false, false, false, webView);
if (m_url)
m_url->MakeFocus(true);
}
}
// #pragma mark - Notification API
@@ -434,9 +440,12 @@ void LauncherWindow::newWindowRequested(const BString& url)
// Always open new windows in the application thread, since
// creating a WebView will try to grab the application lock.
// But our own WebPage may already try to lock us from within
// the application thread -> dead-lock.
BMessage message(NEW_WINDOW);
// the application thread -> dead-lock. Thus we can't wait for
// a reply here.
BMessage message(NEW_TAB);
message.AddPointer("window", this);
message.AddString("url", url);
message.AddBool("select", false);
be_app->PostMessage(&message);
}
+1 -1
View File
@@ -67,7 +67,7 @@ public:
virtual bool QuitRequested();
virtual void MenusBeginning();
void newTab();
void newTab(const BString& url, bool select);
private:
// WebPage notification API implementations