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:
@@ -12,17 +12,16 @@
|
|||||||
#include "Utility.h"
|
#include "Utility.h"
|
||||||
|
|
||||||
ScreenDrawView::ScreenDrawView(BRect rect, char *name)
|
ScreenDrawView::ScreenDrawView(BRect rect, char *name)
|
||||||
: BView(rect, name, B_FOLLOW_ALL, B_WILL_DRAW),
|
: BView(rect, name, B_FOLLOW_ALL, B_WILL_DRAW)
|
||||||
fScreen(new BScreen(B_MAIN_SCREEN_ID))
|
|
||||||
|
|
||||||
{
|
{
|
||||||
if (!fScreen->IsValid())
|
BScreen screen(B_MAIN_SCREEN_ID);
|
||||||
|
if (!screen->IsValid())
|
||||||
; //Debugger() ?
|
; //Debugger() ?
|
||||||
|
|
||||||
desktopColor = fScreen->DesktopColor(current_workspace());
|
desktopColor = screen->DesktopColor(current_workspace());
|
||||||
|
|
||||||
display_mode mode;
|
display_mode mode;
|
||||||
fScreen->GetMode(&mode);
|
screen->GetMode(&mode);
|
||||||
|
|
||||||
fResolution = mode.virtual_width;
|
fResolution = mode.virtual_width;
|
||||||
}
|
}
|
||||||
@@ -217,7 +216,11 @@ ScreenDrawView::MessageReceived(BMessage* message)
|
|||||||
|
|
||||||
case UPDATE_DESKTOP_COLOR_MSG:
|
case UPDATE_DESKTOP_COLOR_MSG:
|
||||||
{
|
{
|
||||||
desktopColor = fScreen->DesktopColor(current_workspace());
|
BScreen screen;
|
||||||
|
if (!screen.IsValid())
|
||||||
|
break;
|
||||||
|
|
||||||
|
desktopColor = screen->DesktopColor(current_workspace());
|
||||||
|
|
||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ public:
|
|||||||
virtual void MouseDown(BPoint point);
|
virtual void MouseDown(BPoint point);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BScreen *fScreen;
|
|
||||||
rgb_color desktopColor;
|
rgb_color desktopColor;
|
||||||
int32 fResolution;
|
int32 fResolution;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user