* The workspaces window now cannot be moved with the Workspaces app anymore;

was a bit strange anyway - this closed bug #317.
* The selected window now gets a selection frame in case it can be moved.
* If the window cannot be moved, a new workspace isn't selected either.
* When choosing a workspace, the one currently selected also gets a selection
  frame.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16823 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-03-17 17:09:40 +00:00
parent 9a46df8614
commit acfa924c01
2 changed files with 43 additions and 7 deletions

View File

@ -171,14 +171,18 @@ WorkspacesLayer::_DrawWindow(DrawingEngine* drawingEngine, const BRect& workspac
RGBColor yellow;
if (decorator != NULL)
yellow = decorator->Colors().window_tab;
RGBColor gray(180, 180, 180);
RGBColor frameColor(180, 180, 180);
RGBColor white(255, 255, 255);
if (!active) {
_DarkenColor(yellow);
_DarkenColor(gray);
_DarkenColor(frameColor);
_DarkenColor(white);
}
if (window == fSelectedWindow) {
// TODO: what about standard navigation color here?
frameColor.SetColor(80, 80, 80);
}
if (tabFrame.left < frame.left)
tabFrame.left = frame.left;
@ -194,7 +198,7 @@ WorkspacesLayer::_DrawWindow(DrawingEngine* drawingEngine, const BRect& workspac
if (decorator != NULL)
drawingEngine->StrokeLine(tabFrame.LeftTop(), tabFrame.RightBottom(), yellow);
drawingEngine->StrokeRect(frame, gray);
drawingEngine->StrokeRect(frame, frameColor);
frame.InsetBy(1, 1);
drawingEngine->FillRect(frame, white);
@ -239,6 +243,9 @@ WorkspacesLayer::_DrawWorkspace(DrawingEngine* drawingEngine,
// draw active frame
RGBColor black(0, 0, 0);
drawingEngine->StrokeRect(rect, black);
} else if (index == fSelectedWorkspace) {
RGBColor gray(80, 80, 80);
drawingEngine->StrokeRect(rect, gray);
}
rect.InsetBy(1, 1);
@ -282,6 +289,14 @@ WorkspacesLayer::_DarkenColor(RGBColor& color) const
}
void
WorkspacesLayer::_Invalidate() const
{
BRegion region(Frame());
Window()->MarkContentDirty(region);
}
void
WorkspacesLayer::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping,
BRegion* windowContentClipping, bool deep)
@ -400,11 +415,17 @@ WorkspacesLayer::MouseDown(BMessage* message, BPoint where)
// If this window is movable, we keep it selected
if (fSelectedWindow != NULL && (fSelectedWindow->Flags() & B_NOT_MOVABLE) != 0)
if (fSelectedWindow != NULL && (fSelectedWindow->Flags() & B_NOT_MOVABLE) != 0
|| fSelectedWindow == Window()) {
fSelectedWindow = NULL;
index = -1;
}
fLeftTopOffset = where - windowFrame.LeftTop();
fSelectedWorkspace = index;
if (index >= 0)
_Invalidate();
}
@ -418,14 +439,20 @@ WorkspacesLayer::MouseUp(BMessage* message, BPoint where)
Window()->Desktop()->SetWorkspace(index);
}
if (fSelectedWindow != NULL) {
// We need to hide the selection frame again
_Invalidate();
}
fSelectedWindow = NULL;
fSelectedWorkspace = -1;
}
void
WorkspacesLayer::MouseMoved(BMessage* message, BPoint where)
{
if (fSelectedWindow == NULL)
if (fSelectedWindow == NULL && fSelectedWorkspace < 0)
return;
// check if the correct mouse button is pressed
@ -441,6 +468,15 @@ WorkspacesLayer::MouseMoved(BMessage* message, BPoint where)
int32 index;
BRect workspaceFrame = _WorkspaceAt(where, index);
if (fSelectedWindow == NULL) {
if (fSelectedWorkspace >= 0 && fSelectedWorkspace != index) {
fSelectedWorkspace = index;
_Invalidate();
}
return;
}
workspaceFrame.InsetBy(1, 1);
if (index != fSelectedWorkspace) {
@ -481,8 +517,7 @@ void
WorkspacesLayer::WindowChanged(WindowLayer* window)
{
// TODO: be smarter about this!
BRegion region(Frame());
Window()->MarkContentDirty(region);
_Invalidate();
}

View File

@ -49,6 +49,7 @@ class WorkspacesLayer : public ViewLayer {
int32 index);
void _DarkenColor(RGBColor& color) const;
void _Invalidate() const;
private:
WindowLayer* fSelectedWindow;