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
+16 -3
View File
@@ -202,6 +202,7 @@ ShowImageView::ShowImageView(BRect rect, const char *name, uint32 resizingMode,
#if DELAYED_SCALING #if DELAYED_SCALING
fScalingCountDown = SCALING_DELAY_TIME; fScalingCountDown = SCALING_DELAY_TIME;
#endif #endif
fHideCursorCountDown = HIDE_CURSOR_DELAY_TIME;
if (settings->Lock()) { if (settings->Lock()) {
fDither = settings->GetBool("Dither", fDither); fDither = settings->GetBool("Dither", fDither);
@@ -310,8 +311,12 @@ ShowImageView::Pulse()
} }
// Hide cursor in full screen mode // Hide cursor in full screen mode
if (fFullScreen && !fShowingPopUpMenu) if (fFullScreen && !fShowingPopUpMenu && fIsActiveWin) {
be_app->ObscureCursor(); if (fHideCursorCountDown <= 0)
be_app->ObscureCursor();
else
fHideCursorCountDown--;
}
#if DELAYED_SCALING #if DELAYED_SCALING
if (fBitmap && (fScaleBilinear || fDither) && fScalingCountDown > 0) { if (fBitmap && (fScaleBilinear || fDither) && fScalingCountDown > 0) {
@@ -624,7 +629,6 @@ ShowImageView::SetFullScreen(bool fullScreen)
fFullScreen = fullScreen; fFullScreen = fullScreen;
if (fFullScreen) { if (fFullScreen) {
SetLowColor(0, 0, 0, 255); SetLowColor(0, 0, 0, 255);
be_app->ObscureCursor();
} else } else
SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
} }
@@ -1375,6 +1379,7 @@ ShowImageView::MergeSelection()
void void
ShowImageView::MouseDown(BPoint position) ShowImageView::MouseDown(BPoint position)
{ {
fHideCursorCountDown = HIDE_CURSOR_DELAY_TIME;
BPoint point; BPoint point;
uint32 buttons; uint32 buttons;
MakeFocus(true); MakeFocus(true);
@@ -1472,6 +1477,7 @@ ShowImageView::UpdateSelectionRect(BPoint point, bool final)
void void
ShowImageView::MouseMoved(BPoint point, uint32 state, const BMessage *message) ShowImageView::MouseMoved(BPoint point, uint32 state, const BMessage *message)
{ {
fHideCursorCountDown = HIDE_CURSOR_DELAY_TIME;
if (fMakesSelection) { if (fMakesSelection) {
UpdateSelectionRect(point, false); UpdateSelectionRect(point, false);
} else if (fMovesImage) { } else if (fMovesImage) {
@@ -2567,3 +2573,10 @@ ShowImageView::ExitFullScreen()
} }
void
ShowImageView::WindowActivated(bool active)
{
fIsActiveWin = active;
fHideCursorCountDown = HIDE_CURSOR_DELAY_TIME;
}
+7
View File
@@ -33,6 +33,9 @@
// width of the black border stroked arround the bitmap // width of the black border stroked arround the bitmap
#define PEN_SIZE 1.0f #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 { class ShowImageView : public BView {
public: public:
ShowImageView(BRect rect, const char *name, uint32 resizingMode, ShowImageView(BRect rect, const char *name, uint32 resizingMode,
@@ -49,6 +52,7 @@ class ShowImageView : public BView {
virtual void Pulse(); virtual void Pulse();
virtual void MessageReceived(BMessage *message); virtual void MessageReceived(BMessage *message);
virtual void WindowActivated(bool active);
void SetTrackerMessenger(const BMessenger& trackerMessenger); void SetTrackerMessenger(const BMessenger& trackerMessenger);
status_t SetImage(const entry_ref *ref); status_t SetImage(const entry_ref *ref);
@@ -237,6 +241,9 @@ class ShowImageView : public BView {
bool fShowingPopUpMenu; bool fShowingPopUpMenu;
int fHideCursorCountDown; // Hides the cursor when it reaches zero
bool fIsActiveWin; // Is the parent window the active window?
enum image_orientation fImageOrientation; enum image_orientation fImageOrientation;
static enum image_orientation fTransformation[ static enum image_orientation fTransformation[
ImageProcessor::kNumberOfAffineTransformations][kNumberOfOrientations]; ImageProcessor::kNumberOfAffineTransformations][kNumberOfOrientations];