From 64ba396fa7688395d5b0de121ff86636e9592f3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 17 Oct 2008 01:31:44 +0000 Subject: [PATCH] * When changing the workspace of a window, it's workspace position will now be set to its current position if that is the only workspace it's in. * This fixes missing windows on other workspaces in the Workspaces app after boot, ie. before you had visited that workspace. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28204 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Desktop.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp index ab6420e0f2..794cf7cb1a 100644 --- a/src/servers/app/Desktop.cpp +++ b/src/servers/app/Desktop.cpp @@ -2013,6 +2013,9 @@ Desktop::_ChangeWindowWorkspaces(Window* window, uint32 oldWorkspaces, LockAllWindows(); + // NOTE: we bypass the anchor-mechanism by intention when switching + // the workspace programmatically. + for (int32 i = 0; i < kMaxWorkspaces; i++) { if (workspace_in_workspaces(i, oldWorkspaces)) { // window is on this workspace, is it anymore? @@ -2048,6 +2051,21 @@ Desktop::_ChangeWindowWorkspaces(Window* window, uint32 oldWorkspaces, } } + // If the window is visible only on one workspace, we set it's current + // position in that workspace (so that WorkspacesView will find us). + int32 firstWorkspace = -1; + for (int32 i = 0; i < kMaxWorkspaces; i++) { + if ((newWorkspaces & (1L << i)) != 0) { + if (firstWorkspace != -1) { + firstWorkspace = -1; + break; + } + firstWorkspace = i; + } + } + if (firstWorkspace >= 0) + window->Anchor(firstWorkspace).position = window->Frame().LeftTop(); + // take care about modals and floating windows _UpdateSubsetWorkspaces(window);