* Added a new Workspace::GetPreviousWindow() method to allow traversing the window
list in the other direction. * Since WorkspacesLayer now cuts out the current window from the clipping region, the window order was upside down; it now uses the new Workspace::GetPreviousWindow(). This fixes bug #1105. * WorkspacesLayer::MouseDown() now also uses GetPreviousWindow() which prevents it from needing to scan the whole window list for the top window at every click. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20382 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005-2006, Haiku.
|
* Copyright 2005-2007, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -138,6 +138,28 @@ Workspace::GetNextWindow(WindowLayer*& _window, BPoint& _leftTop)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
Workspace::GetPreviousWindow(WindowLayer*& _window, BPoint& _leftTop)
|
||||||
|
{
|
||||||
|
if (fCurrent == NULL)
|
||||||
|
fCurrent = fWorkspace.Windows().LastWindow();
|
||||||
|
else
|
||||||
|
fCurrent = fCurrent->PreviousWindow(fWorkspace.Index());
|
||||||
|
|
||||||
|
if (fCurrent == NULL)
|
||||||
|
return B_ENTRY_NOT_FOUND;
|
||||||
|
|
||||||
|
_window = fCurrent;
|
||||||
|
|
||||||
|
if (fCurrentWorkspace)
|
||||||
|
_leftTop = fCurrent->Frame().LeftTop();
|
||||||
|
else
|
||||||
|
_leftTop = fCurrent->Anchor(fWorkspace.Index()).position;
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Workspace::RewindWindows()
|
Workspace::RewindWindows()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005, Haiku.
|
* Copyright 2005-2007, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -28,6 +28,7 @@ class Workspace {
|
|||||||
{ return fCurrentWorkspace; }
|
{ return fCurrentWorkspace; }
|
||||||
|
|
||||||
status_t GetNextWindow(WindowLayer*& _window, BPoint& _leftTop);
|
status_t GetNextWindow(WindowLayer*& _window, BPoint& _leftTop);
|
||||||
|
status_t GetPreviousWindow(WindowLayer*& _window, BPoint& _leftTop);
|
||||||
void RewindWindows();
|
void RewindWindows();
|
||||||
|
|
||||||
class Private;
|
class Private;
|
||||||
|
|||||||
@@ -262,16 +262,16 @@ WorkspacesLayer::_DrawWorkspace(DrawingEngine* drawingEngine,
|
|||||||
backgroundRegion.IntersectWith(&workspaceRegion);
|
backgroundRegion.IntersectWith(&workspaceRegion);
|
||||||
drawingEngine->ConstrainClippingRegion(&backgroundRegion);
|
drawingEngine->ConstrainClippingRegion(&backgroundRegion);
|
||||||
|
|
||||||
|
// We draw from top down and cut the window out of the clipping region
|
||||||
|
// which reduces the flickering
|
||||||
WindowLayer* window;
|
WindowLayer* window;
|
||||||
BPoint leftTop;
|
BPoint leftTop;
|
||||||
while (workspace.GetNextWindow(window, leftTop) == B_OK) {
|
while (workspace.GetPreviousWindow(window, leftTop) == B_OK) {
|
||||||
_DrawWindow(drawingEngine, rect, screenFrame, window,
|
_DrawWindow(drawingEngine, rect, screenFrame, window,
|
||||||
leftTop, backgroundRegion, active);
|
leftTop, backgroundRegion, active);
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw background
|
// draw background
|
||||||
|
|
||||||
//drawingEngine->ConstrainClippingRegion(&backgroundRegion);
|
|
||||||
drawingEngine->FillRect(rect, color);
|
drawingEngine->FillRect(rect, color);
|
||||||
|
|
||||||
drawingEngine->ConstrainClippingRegion(&redraw);
|
drawingEngine->ConstrainClippingRegion(&redraw);
|
||||||
@@ -376,15 +376,14 @@ WorkspacesLayer::MouseDown(BMessage* message, BPoint where)
|
|||||||
WindowLayer* window;
|
WindowLayer* window;
|
||||||
BRect windowFrame;
|
BRect windowFrame;
|
||||||
BPoint leftTop;
|
BPoint leftTop;
|
||||||
while (workspace.GetNextWindow(window, leftTop) == B_OK) {
|
while (workspace.GetPreviousWindow(window, leftTop) == B_OK) {
|
||||||
BRect frame = _WindowFrame(workspaceFrame, screenFrame, window->Frame(),
|
BRect frame = _WindowFrame(workspaceFrame, screenFrame, window->Frame(),
|
||||||
leftTop);
|
leftTop);
|
||||||
if (frame.Contains(where) && window->Feel() != kDesktopWindowFeel
|
if (frame.Contains(where) && window->Feel() != kDesktopWindowFeel
|
||||||
&& window->Feel() != kWindowScreenFeel) {
|
&& window->Feel() != kWindowScreenFeel) {
|
||||||
// We can't exit the loop here, as we traverse the window
|
|
||||||
// list in the wrong direction...
|
|
||||||
fSelectedWindow = window;
|
fSelectedWindow = window;
|
||||||
windowFrame = frame;
|
windowFrame = frame;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user