Not in mood for too much coding, I had a look through the code tonight. And guess what? Like Stefano

the other day, I discovered, not a bug, but how to invalidate only the area that requires it when
changing window order (selecting or moving to back a window). Stuppid me, that stuff didn't worked
because I forgot how windows were arranged in the list returned by Workspace::GetWMState(). I was
iterating the wrong way! :-)



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14839 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adi Oanca
2005-11-10 21:52:59 +00:00
parent 716677e500
commit e2ad4ab9b2
2 changed files with 25 additions and 11 deletions
+14 -9
View File
@@ -302,27 +302,27 @@ RootLayer::ResizeBy(float x, float y)
Layer* Layer*
RootLayer::FirstChild() const RootLayer::FirstChild() const
{ {
fWinBorderIndex = fWMState.WindowList.CountItems()-1; fWinBorderIndex = 0;
return static_cast<Layer*>(fWMState.WindowList.ItemAt(fWinBorderIndex--)); return static_cast<Layer*>(fWMState.WindowList.ItemAt(fWinBorderIndex++));
} }
Layer* Layer*
RootLayer::NextChild() const RootLayer::NextChild() const
{ {
return static_cast<Layer*>(fWMState.WindowList.ItemAt(fWinBorderIndex--)); return static_cast<Layer*>(fWMState.WindowList.ItemAt(fWinBorderIndex++));
} }
Layer* Layer*
RootLayer::PreviousChild() const RootLayer::PreviousChild() const
{ {
return static_cast<Layer*>(fWMState.WindowList.ItemAt(fWinBorderIndex++)); return static_cast<Layer*>(fWMState.WindowList.ItemAt(fWinBorderIndex--));
} }
Layer* Layer*
RootLayer::LastChild() const RootLayer::LastChild() const
{ {
fWinBorderIndex = 0; fWinBorderIndex = fWMState.WindowList.CountItems()-1;
return static_cast<Layer*>(fWMState.WindowList.ItemAt(fWinBorderIndex++)); return static_cast<Layer*>(fWMState.WindowList.ItemAt(fWinBorderIndex--));
} }
@@ -836,6 +836,7 @@ RootLayer::RevealNewWMState(Workspace::State &oldWMState)
} }
} }
// for new windows, invalidate(rebuild & redraw) the maximum that it can occupy.
for (int32 i = 0; i < newWindowCount; ++i) { for (int32 i = 0; i < newWindowCount; ++i) {
Layer *layer = static_cast<Layer*>(fWMState.WindowList.ItemAtFast(i)); Layer *layer = static_cast<Layer*>(fWMState.WindowList.ItemAtFast(i));
if (!layer) if (!layer)
@@ -849,6 +850,8 @@ RootLayer::RevealNewWMState(Workspace::State &oldWMState)
} }
if (isNewWindow) { if (isNewWindow) {
BRegion invalid; BRegion invalid;
// invalidate the maximum area which this layer/window can occupy.
layer->GetWantedRegion(invalid); layer->GetWantedRegion(invalid);
MarkForRebuild(invalid); MarkForRebuild(invalid);
@@ -859,6 +862,7 @@ RootLayer::RevealNewWMState(Workspace::State &oldWMState)
} }
} }
// if a window came in front ot others, invalidate its previously hidden area.
oldWindowCount = oldStrippedList.CountItems(); oldWindowCount = oldStrippedList.CountItems();
newWindowCount = newStrippedList.CountItems(); newWindowCount = newStrippedList.CountItems();
for (int32 i = 0; i < oldWindowCount; ++i) { for (int32 i = 0; i < oldWindowCount; ++i) {
@@ -867,11 +871,12 @@ RootLayer::RevealNewWMState(Workspace::State &oldWMState)
continue; continue;
if (i < newStrippedList.IndexOf(layer)) { if (i < newStrippedList.IndexOf(layer)) {
BRegion invalid; BRegion invalid;
// start by invalidating the maximum area which this layer/window can occupy.
layer->GetWantedRegion(invalid); layer->GetWantedRegion(invalid);
// TODO: we need to invalidate only the ares that became visible // no reason to invalidate what's currently visible.
// not the whole surface of this layer! invalid.Exclude(&layer->FullVisible());
// invalid.Exclude(&layer->FullVisible());
MarkForRebuild(invalid); MarkForRebuild(invalid);
MarkForRedraw(invalid); MarkForRedraw(invalid);
+11 -2
View File
@@ -227,6 +227,15 @@ Workspace::Active() const
return NULL; return NULL;
} }
/*!
\brief Method that returns the state of window manager.
\param state - a pointer to a valid Workspace::State structure
\return void
Fills the state structure with the most important window manager attibutes:
front window, focus window, active window and the list of windows starting from
the backmost one at position 0 and ending with the most visible window.
*/
void void
Workspace::GetState(Workspace::State *state) const Workspace::GetState(Workspace::State *state) const
{ {
@@ -234,11 +243,11 @@ Workspace::GetState(Workspace::State *state) const
state->Focus = Focus(); state->Focus = Focus();
state->Active = Active(); state->Active = Active();
ListData *cursor = fBottomItem; ListData *cursor = fTopItem;
while (cursor) { while (cursor) {
if (!cursor->layerPtr->IsHidden()) if (!cursor->layerPtr->IsHidden())
state->WindowList.AddItem(cursor->layerPtr); state->WindowList.AddItem(cursor->layerPtr);
cursor = cursor->upperItem; cursor = cursor->lowerItem;
} }
} }
bool bool