Implemented Stephan's previous TODO (in an svn commit message) to hide the

cursor after a delay when in fullscreen mode. I set the delay to 5 seconds. In
addition I make sure the ShowImage window is the active window before trying to
hide the cursor, because otherwise there is a lot of cursor flickering if you
change workspaces.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19569 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ryan Leavengood 2006-12-20 01:08:55 +00:00
parent 7da584bb64
commit 6346c8941c
2 changed files with 23 additions and 3 deletions

View File

@ -202,6 +202,7 @@ ShowImageView::ShowImageView(BRect rect, const char *name, uint32 resizingMode,
#if DELAYED_SCALING
fScalingCountDown = SCALING_DELAY_TIME;
#endif
fHideCursorCountDown = HIDE_CURSOR_DELAY_TIME;
if (settings->Lock()) {
fDither = settings->GetBool("Dither", fDither);
@ -310,8 +311,12 @@ ShowImageView::Pulse()
}
// Hide cursor in full screen mode
if (fFullScreen && !fShowingPopUpMenu)
be_app->ObscureCursor();
if (fFullScreen && !fShowingPopUpMenu && fIsActiveWin) {
if (fHideCursorCountDown <= 0)
be_app->ObscureCursor();
else
fHideCursorCountDown--;
}
#if DELAYED_SCALING
if (fBitmap && (fScaleBilinear || fDither) && fScalingCountDown > 0) {
@ -624,7 +629,6 @@ ShowImageView::SetFullScreen(bool fullScreen)
fFullScreen = fullScreen;
if (fFullScreen) {
SetLowColor(0, 0, 0, 255);
be_app->ObscureCursor();
} else
SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
}
@ -1375,6 +1379,7 @@ ShowImageView::MergeSelection()
void
ShowImageView::MouseDown(BPoint position)
{
fHideCursorCountDown = HIDE_CURSOR_DELAY_TIME;
BPoint point;
uint32 buttons;
MakeFocus(true);
@ -1472,6 +1477,7 @@ ShowImageView::UpdateSelectionRect(BPoint point, bool final)
void
ShowImageView::MouseMoved(BPoint point, uint32 state, const BMessage *message)
{
fHideCursorCountDown = HIDE_CURSOR_DELAY_TIME;
if (fMakesSelection) {
UpdateSelectionRect(point, false);
} else if (fMovesImage) {
@ -2567,3 +2573,10 @@ ShowImageView::ExitFullScreen()
}
void
ShowImageView::WindowActivated(bool active)
{
fIsActiveWin = active;
fHideCursorCountDown = HIDE_CURSOR_DELAY_TIME;
}

View File

@ -33,6 +33,9 @@
// width of the black border stroked arround the bitmap
#define PEN_SIZE 1.0f
// the delay time for hiding the cursor in 1/10 seconds (the pulse rate)
#define HIDE_CURSOR_DELAY_TIME 50
class ShowImageView : public BView {
public:
ShowImageView(BRect rect, const char *name, uint32 resizingMode,
@ -49,6 +52,7 @@ class ShowImageView : public BView {
virtual void Pulse();
virtual void MessageReceived(BMessage *message);
virtual void WindowActivated(bool active);
void SetTrackerMessenger(const BMessenger& trackerMessenger);
status_t SetImage(const entry_ref *ref);
@ -237,6 +241,9 @@ class ShowImageView : public BView {
bool fShowingPopUpMenu;
int fHideCursorCountDown; // Hides the cursor when it reaches zero
bool fIsActiveWin; // Is the parent window the active window?
enum image_orientation fImageOrientation;
static enum image_orientation fTransformation[
ImageProcessor::kNumberOfAffineTransformations][kNumberOfOrientations];