Activating all windows in a stack caused flickering. The reason to activate all windows was to get all windows form a stack into the upper window layers, otherwise it was possible that the top layer stack window is activated but another window in the stack is at the bottommost layer position. Sending this window to the back does not triggered sending the complete stack to the back. The send behind call is now redirected to the top most stack window to ensure the stack is send behind.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42632 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Clemens Zeidler
2011-08-13 22:59:47 +00:00
parent 0e400be555
commit f33cf3fd44
3 changed files with 27 additions and 36 deletions
+24 -17
View File
@@ -1036,21 +1036,11 @@ Desktop::SelectWindow(Window* window)
of their subset. of their subset.
*/ */
void void
Desktop::ActivateWindow(Window* window, bool activateStack) Desktop::ActivateWindow(Window* window)
{ {
STRACE(("ActivateWindow(%p, %s)\n", window, window STRACE(("ActivateWindow(%p, %s)\n", window, window
? window->Title() : "<none>")); ? window->Title() : "<none>"));
WindowStack* stack = window->GetWindowStack();
if (activateStack && stack != NULL) {
for (int32 i = 0; i < stack->CountWindows(); i++) {
Window* win = stack->LayerOrder().ItemAt(i);
if (window == win)
continue;
ActivateWindow(win, false);
}
}
if (window == NULL) { if (window == NULL) {
fBack = NULL; fBack = NULL;
fFront = NULL; fFront = NULL;
@@ -1164,11 +1154,16 @@ Desktop::ActivateWindow(Window* window, bool activateStack)
void void
Desktop::SendWindowBehind(Window* window, Window* behindOf) Desktop::SendWindowBehind(Window* window, Window* behindOf, bool sendStack)
{ {
if (!LockAllWindows()) if (!LockAllWindows())
return; return;
Window* orgWindow = window;
WindowStack* stack = window->GetWindowStack();
if (sendStack && stack != NULL)
window = stack->TopLayerWindow();
// TODO: should the "not in current workspace" be handled anyway? // TODO: should the "not in current workspace" be handled anyway?
// (the code below would have to be changed then, though) // (the code below would have to be changed then, though)
if (window == BackWindow() if (window == BackWindow()
@@ -1195,10 +1190,13 @@ Desktop::SendWindowBehind(Window* window, Window* behindOf)
BRegion dummy; BRegion dummy;
_RebuildClippingForAllWindows(dummy); _RebuildClippingForAllWindows(dummy);
// mark everything dirty that is no longer visible // only redraw the top layer window to avoid flicker
BRegion clean(window->VisibleRegion()); if (sendStack) {
dirty.Exclude(&clean); // mark everything dirty that is no longer visible
MarkDirty(dirty); BRegion clean(window->VisibleRegion());
dirty.Exclude(&clean);
MarkDirty(dirty);
}
_UpdateFronts(); _UpdateFronts();
if (fSettings->MouseMode() == B_FOCUS_FOLLOWS_MOUSE) if (fSettings->MouseMode() == B_FOCUS_FOLLOWS_MOUSE)
@@ -1212,7 +1210,16 @@ Desktop::SendWindowBehind(Window* window, Window* behindOf)
_WindowChanged(window); _WindowChanged(window);
NotifyWindowSentBehind(window, behindOf); if (sendStack && stack != NULL) {
for (int32 i = 0; i < stack->CountWindows(); i++) {
Window* stackWindow = stack->LayerOrder().ItemAt(i);
if (stackWindow == window)
continue;
SendWindowBehind(stackWindow, behindOf, false);
}
}
NotifyWindowSentBehind(orgWindow, behindOf);
UnlockAllWindows(); UnlockAllWindows();
+3 -3
View File
@@ -160,10 +160,10 @@ public:
// Window methods // Window methods
void SelectWindow(Window* window); void SelectWindow(Window* window);
void ActivateWindow(Window* window, void ActivateWindow(Window* window);
bool activateStack = true);
void SendWindowBehind(Window* window, void SendWindowBehind(Window* window,
Window* behindOf = NULL); Window* behindOf = NULL,
bool sendStack = true);
void ShowWindow(Window* window); void ShowWindow(Window* window);
void HideWindow(Window* window, void HideWindow(Window* window,
@@ -308,22 +308,6 @@ StackAndTile::WindowActitvated(Window* window)
void void
StackAndTile::WindowSentBehind(Window* window, Window* behindOf) StackAndTile::WindowSentBehind(Window* window, Window* behindOf)
{ {
SATWindow* satWindow = GetSATWindow(window);
if (satWindow == NULL)
return;
SATGroup* group = satWindow->GetGroup();
if (group == NULL)
return;
Desktop* desktop = satWindow->GetWindow()->Desktop();
if (desktop == NULL)
return;
WindowIterator iter(group, true);
for (SATWindow* listWindow = iter.NextWindow(); listWindow != NULL;
listWindow = iter.NextWindow()) {
if (listWindow != satWindow)
desktop->SendWindowBehind(listWindow->GetWindow(), behindOf);
}
} }