Author: stippi Date: Tue Apr 6 01:24:07 2010 New Revision: 391 URL: http://mmlr.dyndns.org/changeset/391 Log: Remember the currently focused view within a tab in the user data that can be associated with a BWebView and restore the focus when the tab changes. This fixes a number of annoying issues. Modified: webkit/trunk/WebKit/haiku/WebPositive/BrowserWindow.cpp Modified: webkit/trunk/WebKit/haiku/WebPositive/BrowserWindow.cpp ============================================================================== --- webkit/trunk/WebKit/haiku/WebPositive/BrowserWindow.cpp Tue Apr 6 01:15:17 2010 (r390) +++ webkit/trunk/WebKit/haiku/WebPositive/BrowserWindow.cpp Tue Apr 6 01:24:07 2010 (r391) @@ -236,6 +236,24 @@ }; +class PageUserData : public BWebView::UserData { +public: + PageUserData(BView* focusedView) + : + fFocusedView(focusedView) + { + } + + BView* FocusedView() const + { + return fFocusedView; + } + +private: + BView* fFocusedView; +}; + + // #pragma mark - BrowserWindow @@ -1173,7 +1191,17 @@ BWebView* webView = dynamic_cast<BWebView*>(fTabManager->ViewForTab(index)); if (webView == CurrentWebView()) return; + + CurrentWebView()->SetUserData(new PageUserData(CurrentFocus())); + SetCurrentWebView(webView); + + PageUserData* userData = static_cast<PageUserData*>(webView->GetUserData()); + if (userData) + userData->FocusedView()->MakeFocus(true); + else + webView->MakeFocus(true); + if (webView) _UpdateTitle(webView->MainFrameTitle()); else