WorkspacesLayer now makes use of DisplayDriver::ConstrainClippingRegion() in
order to flicker less (which works, but it's not really that nice yet, as it currently only works for the background). The workspaces layer is now also invalidated if a new window appears on the screen or goes away (also when this happens in another workspace). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13379 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1996,9 +1996,14 @@ RootLayer::show_winBorder(WinBorder *winBorder)
|
|||||||
|
|
||||||
if (invalidate)
|
if (invalidate)
|
||||||
show_final_scene(exFocus, exActive);
|
show_final_scene(exFocus, exActive);
|
||||||
|
|
||||||
|
if (WorkspacesLayer())
|
||||||
|
GoRedraw(WorkspacesLayer(), fFullVisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RootLayer::hide_winBorder(WinBorder *winBorder)
|
|
||||||
|
void
|
||||||
|
RootLayer::hide_winBorder(WinBorder *winBorder)
|
||||||
{
|
{
|
||||||
bool invalidate = false;
|
bool invalidate = false;
|
||||||
bool invalid;
|
bool invalid;
|
||||||
@@ -2024,9 +2029,14 @@ void RootLayer::hide_winBorder(WinBorder *winBorder)
|
|||||||
|
|
||||||
if (invalidate)
|
if (invalidate)
|
||||||
show_final_scene(exFocus, exActive);
|
show_final_scene(exFocus, exActive);
|
||||||
|
|
||||||
|
if (WorkspacesLayer())
|
||||||
|
GoRedraw(WorkspacesLayer(), fFullVisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RootLayer::change_winBorder_feel(WinBorder *winBorder, int32 newFeel)
|
|
||||||
|
void
|
||||||
|
RootLayer::change_winBorder_feel(WinBorder *winBorder, int32 newFeel)
|
||||||
{
|
{
|
||||||
bool isVisible = false;
|
bool isVisible = false;
|
||||||
bool wasVisibleInActiveWorkspace = false;
|
bool wasVisibleInActiveWorkspace = false;
|
||||||
|
|||||||
@@ -76,12 +76,12 @@ WorkspacesLayer::_WindowFrame(const BRect& workspaceFrame,
|
|||||||
BRect frame = windowFrame;
|
BRect frame = windowFrame;
|
||||||
|
|
||||||
float factor = workspaceFrame.Width() / screenFrame.Width();
|
float factor = workspaceFrame.Width() / screenFrame.Width();
|
||||||
frame.left *= factor;
|
frame.left = rintf(frame.left * factor);
|
||||||
frame.right *= factor;
|
frame.right = rintf(frame.right * factor);
|
||||||
|
|
||||||
factor = workspaceFrame.Height() / screenFrame.Height();
|
factor = workspaceFrame.Height() / screenFrame.Height();
|
||||||
frame.top *= factor;
|
frame.top = rintf(frame.top * factor);
|
||||||
frame.bottom *= factor;
|
frame.bottom = rintf(frame.bottom * factor);
|
||||||
|
|
||||||
frame.OffsetBy(workspaceFrame.LeftTop());
|
frame.OffsetBy(workspaceFrame.LeftTop());
|
||||||
return frame;
|
return frame;
|
||||||
@@ -90,7 +90,8 @@ WorkspacesLayer::_WindowFrame(const BRect& workspaceFrame,
|
|||||||
|
|
||||||
void
|
void
|
||||||
WorkspacesLayer::_DrawWindow(const BRect& workspaceFrame,
|
WorkspacesLayer::_DrawWindow(const BRect& workspaceFrame,
|
||||||
const BRect& screenFrame, WinBorder* window)
|
const BRect& screenFrame, WinBorder* window,
|
||||||
|
BRegion& backgroundRegion)
|
||||||
{
|
{
|
||||||
BRect frame = _WindowFrame(workspaceFrame, screenFrame, window->Frame());
|
BRect frame = _WindowFrame(workspaceFrame, screenFrame, window->Frame());
|
||||||
BRect tabFrame = _WindowFrame(workspaceFrame, screenFrame,
|
BRect tabFrame = _WindowFrame(workspaceFrame, screenFrame,
|
||||||
@@ -99,8 +100,18 @@ WorkspacesLayer::_DrawWindow(const BRect& workspaceFrame,
|
|||||||
// ToDo: let decorator do this!
|
// ToDo: let decorator do this!
|
||||||
RGBColor yellow = window->GetDecorator()->GetColors().window_tab;
|
RGBColor yellow = window->GetDecorator()->GetColors().window_tab;
|
||||||
|
|
||||||
fDriver->StrokeLine(BPoint(tabFrame.left, frame.top - 1),
|
if (tabFrame.left < frame.left)
|
||||||
BPoint(tabFrame.right, frame.top - 1), yellow);
|
tabFrame.left = frame.left;
|
||||||
|
if (tabFrame.right >= frame.right)
|
||||||
|
tabFrame.right = frame.right - 1;
|
||||||
|
|
||||||
|
tabFrame.top = frame.top - 1;
|
||||||
|
tabFrame.bottom = frame.top - 1;
|
||||||
|
|
||||||
|
backgroundRegion.Exclude(tabFrame);
|
||||||
|
backgroundRegion.Exclude(frame);
|
||||||
|
|
||||||
|
fDriver->StrokeLine(tabFrame.LeftTop(), tabFrame.RightBottom(), yellow);
|
||||||
|
|
||||||
RGBColor gray(180, 180, 180);
|
RGBColor gray(180, 180, 180);
|
||||||
fDriver->StrokeRect(frame, gray);
|
fDriver->StrokeRect(frame, gray);
|
||||||
@@ -134,28 +145,35 @@ WorkspacesLayer::_DrawWorkspace(int32 index)
|
|||||||
else
|
else
|
||||||
color.SetColor(51, 102, 152);
|
color.SetColor(51, 102, 152);
|
||||||
|
|
||||||
fDriver->FillRect(rect, color);
|
|
||||||
|
|
||||||
if (workspace == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// draw windows
|
// draw windows
|
||||||
|
|
||||||
WinBorder* windows[256];
|
BRegion backgroundRegion = fVisible;
|
||||||
int32 count = 256;
|
// ToDo: would be nice to get the real update region here
|
||||||
if (!workspace->GetWinBorderList((void **)&windows, &count))
|
|
||||||
return;
|
|
||||||
|
|
||||||
uint16 width, height;
|
if (workspace != NULL) {
|
||||||
uint32 colorSpace;
|
WinBorder* windows[256];
|
||||||
float frequency;
|
int32 count = 256;
|
||||||
gDesktop->ScreenAt(0)->GetMode(width, height, colorSpace, frequency);
|
if (!workspace->GetWinBorderList((void **)&windows, &count))
|
||||||
|
return;
|
||||||
|
|
||||||
BRect screenFrame(0, 0, width - 1, height - 1);
|
uint16 width, height;
|
||||||
|
uint32 colorSpace;
|
||||||
|
float frequency;
|
||||||
|
gDesktop->ScreenAt(0)->GetMode(width, height, colorSpace, frequency);
|
||||||
|
BRect screenFrame(0, 0, width - 1, height - 1);
|
||||||
|
|
||||||
for (int32 i = count; i-- > 0;) {
|
BRegion workspaceRegion(rect);
|
||||||
_DrawWindow(rect, screenFrame, windows[i]);
|
backgroundRegion.IntersectWith(&workspaceRegion);
|
||||||
|
fDriver->ConstrainClippingRegion(&backgroundRegion);
|
||||||
|
|
||||||
|
for (int32 i = count; i-- > 0;) {
|
||||||
|
_DrawWindow(rect, screenFrame, windows[i], backgroundRegion);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fDriver->ConstrainClippingRegion(&backgroundRegion);
|
||||||
|
fDriver->FillRect(rect, color);
|
||||||
|
fDriver->ConstrainClippingRegion(&fVisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ class WorkspacesLayer : public Layer {
|
|||||||
const BRect& screenFrame, const BRect& windowFrame);
|
const BRect& screenFrame, const BRect& windowFrame);
|
||||||
|
|
||||||
void _DrawWindow(const BRect& workspaceFrame,
|
void _DrawWindow(const BRect& workspaceFrame,
|
||||||
const BRect& screenFrame, WinBorder* window);
|
const BRect& screenFrame, WinBorder* window,
|
||||||
|
BRegion& backgroundRegion);
|
||||||
void _DrawWorkspace(int32 index);
|
void _DrawWorkspace(int32 index);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user