diff --git a/src/apps/deskcalc/CalcView.cpp b/src/apps/deskcalc/CalcView.cpp index b916570c918..673e85756f6 100644 --- a/src/apps/deskcalc/CalcView.cpp +++ b/src/apps/deskcalc/CalcView.cpp @@ -315,12 +315,7 @@ CalcView::MessageReceived(BMessage* message) void CalcView::Draw(BRect updateRect) { - bool drawBackground = true; - if (Parent() && (Parent()->Flags() & B_DRAW_ON_CHILDREN) != 0) { - // CalcView is embedded somewhere, most likely the Tracker Desktop - // shelf. - drawBackground = false; - } + bool drawBackground = !_IsEmbedded(); SetHighColor(fBaseColor); BRect expressionRect(_ExpressionRect()); @@ -809,13 +804,16 @@ CalcView::SetDegreeMode(bool degrees) void CalcView::SetKeypadMode(uint8 mode) { - if (fOptions->keypad_mode == mode) + if (_IsEmbedded()) return; BWindow* window = Window(); if (window == NULL) return; + if (fOptions->keypad_mode == mode) + return; + fOptions->keypad_mode = mode; _MarkKeypadItems(fOptions->keypad_mode); @@ -1278,3 +1276,12 @@ CalcView::_FetchAppIcon(BBitmap* into) if (status != B_OK) memset(into->Bits(), 0, into->BitsLength()); } + + +// Returns whether or not CalcView is embedded somewhere, most likely +// the Desktop +bool +CalcView::_IsEmbedded() +{ + return Parent() != NULL && (Parent()->Flags() & B_DRAW_ON_CHILDREN) != 0; +} diff --git a/src/apps/deskcalc/CalcView.h b/src/apps/deskcalc/CalcView.h index 811313df2a8..a4a45bc1806 100644 --- a/src/apps/deskcalc/CalcView.h +++ b/src/apps/deskcalc/CalcView.h @@ -117,6 +117,7 @@ class CalcView : public BView { void _MarkKeypadItems(uint8 mode); void _FetchAppIcon(BBitmap* into); + bool _IsEmbedded(); // grid dimensions int16 fColumns;