From 799c100e79f8546c965fd7fabcb24b057100db77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 8 Dec 2005 13:32:54 +0000 Subject: [PATCH] That would be a bug indeed. * ShowWindow() and HideWindow() now also work correctly for windows not on the current workspace. * Reverted WindowList::RemoveWindow() - if it is used wrongly, it should better crash the server for now, so that we can iron out the bugs. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15420 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Desktop.cpp | 21 +++++++++++++++------ src/servers/app/WindowList.cpp | 14 ++++---------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp index 1fc9017a3f..ae2a093dd6 100644 --- a/src/servers/app/Desktop.cpp +++ b/src/servers/app/Desktop.cpp @@ -931,8 +931,15 @@ Desktop::ShowWindow(WindowLayer* window) WriteLockWindows(); window->SetHidden(false); - _ShowWindow(window, true); - ActivateWindow(window); + + if (window->OnWorkspace(fCurrentWorkspace)) { + _ShowWindow(window, true); + ActivateWindow(window); + } else { + // then we don't need to send the fake mouse event either + WriteUnlockWindows(); + return; + } WriteUnlockWindows(); @@ -971,11 +978,13 @@ Desktop::HideWindow(WindowLayer* window) window->SetHidden(true); - _HideWindow(window); - _UpdateFronts(); + if (window->OnWorkspace(fCurrentWorkspace)) { + _HideWindow(window); + _UpdateFronts(); - if (FocusWindow() == window) - SetFocusWindow(FrontWindow()); + if (FocusWindow() == window) + SetFocusWindow(FrontWindow()); + } WriteUnlockWindows(); } diff --git a/src/servers/app/WindowList.cpp b/src/servers/app/WindowList.cpp index 0f5349488e..1bfc4c9ddb 100644 --- a/src/servers/app/WindowList.cpp +++ b/src/servers/app/WindowList.cpp @@ -82,28 +82,22 @@ WindowList::AddWindow(WindowLayer* window, WindowLayer* before) void WindowList::RemoveWindow(WindowLayer* window) { -// TODO: Axel, the same window can be removed in the same list -// more than once, would that be a bug? window_anchor& windowAnchor = window->Anchor(fIndex); if (fFirstWindow == window) { // it's the first child fFirstWindow = windowAnchor.next; } else { - // it must have a previous sibling if it was not - // previously removed from this list - if (windowAnchor.previous) - windowAnchor.previous->Anchor(fIndex).next = windowAnchor.next; + // it must have a previous sibling, then + windowAnchor.previous->Anchor(fIndex).next = windowAnchor.next; } if (fLastWindow == window) { // it's the last child fLastWindow = windowAnchor.previous; } else { - // it must have a next sibling if it was not - // previously removed from this list - if (windowAnchor.next) - windowAnchor.next->Anchor(fIndex).previous = windowAnchor.previous; + // then it must have a next sibling + windowAnchor.next->Anchor(fIndex).previous = windowAnchor.previous; } windowAnchor.previous = NULL;