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