In the R4's bebook, they say BScreen objects shouldn't be

constructed on the heap, and a BScreen object should be keep for
as little time as possible, because it locks the screen.
This doesn't seem to be the case in R5, but I am happier this way...


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2095 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2002-11-27 11:57:39 +00:00
parent 87f0c75967
commit b2c7cb6f60
2 changed files with 10 additions and 8 deletions
+10 -7
View File
@@ -12,17 +12,16 @@
#include "Utility.h"
ScreenDrawView::ScreenDrawView(BRect rect, char *name)
: BView(rect, name, B_FOLLOW_ALL, B_WILL_DRAW),
fScreen(new BScreen(B_MAIN_SCREEN_ID))
: BView(rect, name, B_FOLLOW_ALL, B_WILL_DRAW)
{
if (!fScreen->IsValid())
BScreen screen(B_MAIN_SCREEN_ID);
if (!screen->IsValid())
; //Debugger() ?
desktopColor = fScreen->DesktopColor(current_workspace());
desktopColor = screen->DesktopColor(current_workspace());
display_mode mode;
fScreen->GetMode(&mode);
screen->GetMode(&mode);
fResolution = mode.virtual_width;
}
@@ -217,7 +216,11 @@ ScreenDrawView::MessageReceived(BMessage* message)
case UPDATE_DESKTOP_COLOR_MSG:
{
desktopColor = fScreen->DesktopColor(current_workspace());
BScreen screen;
if (!screen.IsValid())
break;
desktopColor = screen->DesktopColor(current_workspace());
Invalidate();
}
-1
View File
@@ -14,7 +14,6 @@ public:
virtual void MouseDown(BPoint point);
private:
BScreen *fScreen;
rgb_color desktopColor;
int32 fResolution;
};