From cb134e2550619a0311f0d39c0a9094d0123cb131 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 2 Feb 2007 18:14:25 +0000 Subject: [PATCH] Resolved a TODO: WorkspacesLayer must take the whole workspaces frame into account, not just the one of the first screen. This also solves a locking bug, as the HWInterface is already read-locked when WorkspacesLayer::Draw() is called. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20054 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Desktop.cpp | 4 +++- src/servers/app/VirtualScreen.cpp | 24 +++++++++++++++++++++++- src/servers/app/VirtualScreen.h | 3 ++- src/servers/app/WorkspacesLayer.cpp | 12 ++---------- 4 files changed, 30 insertions(+), 13 deletions(-) diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp index 70b4710922..a492320980 100644 --- a/src/servers/app/Desktop.cpp +++ b/src/servers/app/Desktop.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2006, Haiku. + * Copyright 2001-2007, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -961,6 +961,8 @@ Desktop::ScreenChanged(Screen* screen, bool makeDefault) window->ServerWindow()->SendMessageToClient(&update); } + fVirtualScreen.UpdateFrame(); + if (makeDefault) { // store settings BMessage settings; diff --git a/src/servers/app/VirtualScreen.cpp b/src/servers/app/VirtualScreen.cpp index e8c198bcd9..ba667a0e1c 100644 --- a/src/servers/app/VirtualScreen.cpp +++ b/src/servers/app/VirtualScreen.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2005-2006, Haiku. + * Copyright 2005-2007, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -155,6 +155,28 @@ VirtualScreen::RemoveScreen(Screen* screen) } +void +VirtualScreen::UpdateFrame() +{ + int32 virtualWidth = 0, virtualHeight = 0; + + for (int32 i = 0; i < fScreenList.CountItems(); i++) { + Screen* screen = fScreenList.ItemAt(i)->screen; + + uint16 width, height; + uint32 colorSpace; + float frequency; + screen->GetMode(width, height, colorSpace, frequency); + + // TODO: compute virtual size depending on the actual screen position! + virtualWidth += width; + virtualHeight += height; + } + + fFrame.Set(0, 0, virtualWidth - 1, virtualHeight - 1); +} + + /*! Returns the smallest frame that spans over all screens */ diff --git a/src/servers/app/VirtualScreen.h b/src/servers/app/VirtualScreen.h index b28f4f8166..1ff4b98ad0 100644 --- a/src/servers/app/VirtualScreen.h +++ b/src/servers/app/VirtualScreen.h @@ -1,5 +1,5 @@ /* - * Copyright 2005, Haiku. + * Copyright 2005-2007, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -37,6 +37,7 @@ class VirtualScreen { status_t AddScreen(Screen* screen); status_t RemoveScreen(Screen* screen); + void UpdateFrame(); BRect Frame() const; // TODO: we need to play with a real multi-screen configuration to diff --git a/src/servers/app/WorkspacesLayer.cpp b/src/servers/app/WorkspacesLayer.cpp index e39f97f48b..30e1d2a28f 100644 --- a/src/servers/app/WorkspacesLayer.cpp +++ b/src/servers/app/WorkspacesLayer.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2005-2006, Haiku Inc. + * Copyright 2005-2007, Haiku Inc. * Distributed under the terms of the MIT License. * * Authors: @@ -60,15 +60,7 @@ WorkspacesLayer::_GetGrid(int32& columns, int32& rows) BRect WorkspacesLayer::_ScreenFrame(int32 i) { - // TODO: we don't need the current screen frame, but the one - // from the workspace! - uint16 width, height; - uint32 colorSpace; - float frequency; - Window()->Desktop()->ScreenAt(0)->GetMode(width, height, - colorSpace, frequency); - - return BRect(0, 0, width - 1, height - 1); + return Window()->Desktop()->VirtualScreen().Frame(); }