diff --git a/src/servers/app/ServerApp.cpp b/src/servers/app/ServerApp.cpp index 587995c049..d7222c6e5c 100644 --- a/src/servers/app/ServerApp.cpp +++ b/src/servers/app/ServerApp.cpp @@ -126,6 +126,9 @@ ServerApp::ServerApp(Desktop* desktop, port_id clientReplyPort, fAppCursor->SetOwningTeam(fClientTeam); } + fInitialWorkspace = desktop->CurrentWorkspace(); + // TODO: this should probably be retrieved when the app is loaded! + STRACE(("ServerApp %s:\n", Signature())); STRACE(("\tBApp port: %ld\n", fClientReplyPort)); STRACE(("\tReceiver port: %ld\n", fMessagePort)); diff --git a/src/servers/app/ServerApp.h b/src/servers/app/ServerApp.h index ea2a401425..21dbc13711 100644 --- a/src/servers/app/ServerApp.h +++ b/src/servers/app/ServerApp.h @@ -66,6 +66,7 @@ class ServerApp : public MessageLooper { void RemoveWindow(ServerWindow* window); bool InWorkspace(int32 index) const; uint32 Workspaces() const; + int32 InitialWorkspace() const { return fInitialWorkspace; } int32 CountBitmaps() const; ServerBitmap *FindBitmap(int32 token) const; @@ -105,6 +106,8 @@ class ServerApp : public MessageLooper { BObjectList fWindowList; BPrivate::BTokenSpace fViewTokens; + int32 fInitialWorkspace; + // TODO: // - Are really Bitmaps and Pictures stored per application and not globally ? // - As we reference these stuff by token, what about putting them in hash tables ? diff --git a/src/servers/app/WindowLayer.cpp b/src/servers/app/WindowLayer.cpp index acc17fc356..e9c7aa5c26 100644 --- a/src/servers/app/WindowLayer.cpp +++ b/src/servers/app/WindowLayer.cpp @@ -1237,10 +1237,20 @@ WindowLayer::InWorkspace(int32 index) const || fFeel == B_FLOATING_ALL_WINDOW_FEEL) return true; - if (fFeel == B_MODAL_APP_WINDOW_FEEL - || fFeel == B_FLOATING_APP_WINDOW_FEEL) + if (fFeel == B_FLOATING_APP_WINDOW_FEEL) return ServerWindow()->App()->InWorkspace(index); + if (fFeel == B_MODAL_APP_WINDOW_FEEL) { + uint32 workspaces = ServerWindow()->App()->Workspaces(); + if (workspaces == 0) { + // The application doesn't seem to have any other windows + // open or visible - but we'd like to see modal windows + // anyway, at least when they are first opened. + return index == ServerWindow()->App()->InitialWorkspace(); + } + return (workspaces & (1UL << index)) != 0; + } + if (fFeel == B_MODAL_SUBSET_WINDOW_FEEL || fFeel == B_FLOATING_SUBSET_WINDOW_FEEL) { for (int32 i = 0; i < fSubsets.CountItems(); i++) { @@ -1422,10 +1432,20 @@ WindowLayer::SubsetWorkspaces() const || fFeel == B_FLOATING_ALL_WINDOW_FEEL) return B_ALL_WORKSPACES; - if (fFeel == B_MODAL_APP_WINDOW_FEEL - || fFeel == B_FLOATING_APP_WINDOW_FEEL) + if (fFeel == B_FLOATING_APP_WINDOW_FEEL) return ServerWindow()->App()->Workspaces(); + if (fFeel == B_MODAL_APP_WINDOW_FEEL) { + uint32 workspaces = ServerWindow()->App()->Workspaces(); + if (workspaces == 0) { + // The application doesn't seem to have any other windows + // open or visible - but we'd like to see modal windows + // anyway, at least when they are first opened. + return 1UL << ServerWindow()->App()->InitialWorkspace(); + } + return workspaces; + } + if (fFeel == B_MODAL_SUBSET_WINDOW_FEEL || fFeel == B_FLOATING_SUBSET_WINDOW_FEEL) { uint32 workspaces = 0;