* Moved auto-hiding the mouse pointer into BWebView::Pulse().

* Unhide the interface when the user invokes CMD-L (Open location).
* Make sure the progress bar is really hidden, sometimes it would be
  visible again after unhiding the rest of the interface.
* Added a setting for the auto-hiding the mouse pointer feature. It defaults
  to true, since I think it's useful for an app where the pointer would
  usually be in the way.
* Hide the mouse pointer in any case as soon as the user begins typing, also
  hide potentially showing tool tips in that case.

git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@496 94f232f2-1747-11df-bad5-a5bfde151594
This commit is contained in:
stippi
2012-07-03 15:44:10 +02:00
committed by Alexandre Deckner
parent 59b99c1229
commit 208ecbcad5
6 changed files with 59 additions and 33 deletions
+17 -11
View File
@@ -203,7 +203,8 @@ BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* appSettings,
fAppSettings(appSettings),
fZoomTextOnly(true),
fShowTabsIfSinglePageOpen(true),
fAutoHideInterfaceInFullscreenMode(false)
fAutoHideInterfaceInFullscreenMode(false),
fAutoHidePointer(true)
{
// Begin listening to settings changes and read some current values.
fAppSettings->AddListener(BMessenger(this));
@@ -211,6 +212,9 @@ BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* appSettings,
fShowTabsIfSinglePageOpen = fAppSettings->GetValue(
kSettingsKeyShowTabsIfSinglePageOpen, fShowTabsIfSinglePageOpen);
fAutoHidePointer = fAppSettings->GetValue(kSettingsKeyAutoHidePointer,
fAutoHidePointer);
fNewWindowPolicy = fAppSettings->GetValue(kSettingsKeyNewWindowPolicy,
(uint32)OpenStartPage);
fNewTabPolicy = fAppSettings->GetValue(kSettingsKeyNewTabPolicy,
@@ -506,6 +510,7 @@ BrowserWindow::MessageReceived(BMessage* message)
{
switch (message->what) {
case OPEN_LOCATION:
_ShowInterface(true);
if (fURLInputGroup->TextView()->IsFocus())
fURLInputGroup->TextView()->SelectAll();
else
@@ -770,6 +775,11 @@ BrowserWindow::MessageReceived(BMessage* message)
fShowTabsIfSinglePageOpen = flag;
_UpdateTabGroupVisibility();
}
} else if (name == kSettingsKeyAutoHidePointer
&& message->FindBool("value", &flag) == B_OK) {
fAutoHidePointer = flag;
if (CurrentWebView())
CurrentWebView()->SetAutoHidePointer(fAutoHidePointer);
} else if (name == kSettingsKeyStartPageURL
&& message->FindString("value", &string) == B_OK) {
fStartPageURL = string;
@@ -882,6 +892,8 @@ BrowserWindow::SetCurrentWebView(BWebView* webView)
BWebWindow::SetCurrentWebView(webView);
if (webView != NULL) {
webView->SetAutoHidePointer(fAutoHidePointer);
_UpdateTitle(webView->MainFrameTitle());
// Restore the previous focus or focus the web view.
@@ -1838,22 +1850,16 @@ BrowserWindow::_SetAutoHideInterfaceInFullscreen(bool doIt)
void
BrowserWindow::_CheckAutoHideInterface()
{
if (!fIsFullscreen || !fAutoHideInterfaceInFullscreenMode)
if (!fIsFullscreen || !fAutoHideInterfaceInFullscreenMode
|| (CurrentWebView() != NULL && !CurrentWebView()->IsFocus())) {
return;
bigtime_t now = system_time();
float navigationGroupBottom = fNavigationGroup->IsVisible() ?
fNavigationGroup->Frame().bottom : 0;
if (fLastMousePos.y > navigationGroupBottom
&& now - fLastMouseMovedTime > 1500000) {
be_app->ObscureCursor();
}
if (fLastMousePos.y == 0)
_ShowInterface(true);
else if (fNavigationGroup->IsVisible()
&& fLastMousePos.y > fNavigationGroup->Frame().bottom
&& now - fLastMouseMovedTime > 3000000) {
&& system_time() - fLastMouseMovedTime > 3000000) {
// NOTE: Do not re-use navigationGroupBottom in the above
// check, since we only want to hide the interface when it is visible.
_ShowInterface(false);
@@ -1887,7 +1893,7 @@ BrowserWindow::_ShowInterface(bool show)
}
// TODO: Setting the group visible seems to unhide the status bar.
// Fix in Haiku?
if (!fLoadingProgressBar->IsHidden())
while (!fLoadingProgressBar->IsHidden())
fLoadingProgressBar->Hide();
}