From 953d895e020ece5d50cfc2e76d9f370ceb5c45e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 8 Mar 2008 12:45:54 +0000 Subject: [PATCH] * Got rid of the "Layer" part of WindowLayer, ViewLayer, WorkspacesLayer (now WorkspacesView), OffscreenWindowLayer. * Renamed ServerScreen.cpp/h to Screen.cpp/h (the class was already called Screen). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24303 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Desktop.cpp | 161 +++-- src/servers/app/Desktop.h | 103 +-- src/servers/app/Jamfile | 10 +- src/servers/app/OffscreenServerWindow.cpp | 27 +- src/servers/app/OffscreenServerWindow.h | 31 +- ...eenWindowLayer.cpp => OffscreenWindow.cpp} | 27 +- src/servers/app/OffscreenWindow.h | 32 + src/servers/app/OffscreenWindowLayer.h | 33 - .../app/{ServerScreen.cpp => Screen.cpp} | 4 +- src/servers/app/{ServerScreen.h => Screen.h} | 0 src/servers/app/ScreenManager.cpp | 4 +- src/servers/app/ServerApp.cpp | 10 +- src/servers/app/ServerPicture.cpp | 128 ++-- src/servers/app/ServerPicture.h | 29 +- src/servers/app/ServerWindow.cpp | 652 +++++++++--------- src/servers/app/ServerWindow.h | 37 +- src/servers/app/{ViewLayer.cpp => View.cpp} | 214 +++--- src/servers/app/{ViewLayer.h => View.h} | 57 +- .../app/{WindowLayer.cpp => Window.cpp} | 213 +++--- src/servers/app/{WindowLayer.h => Window.h} | 74 +- src/servers/app/WindowList.cpp | 10 +- src/servers/app/WindowList.h | 42 +- src/servers/app/Workspace.cpp | 8 +- src/servers/app/Workspace.h | 10 +- src/servers/app/WorkspacePrivate.h | 6 +- ...WorkspacesLayer.cpp => WorkspacesView.cpp} | 58 +- .../{WorkspacesLayer.h => WorkspacesView.h} | 26 +- 27 files changed, 1004 insertions(+), 1002 deletions(-) rename src/servers/app/{OffscreenWindowLayer.cpp => OffscreenWindow.cpp} (74%) create mode 100644 src/servers/app/OffscreenWindow.h delete mode 100644 src/servers/app/OffscreenWindowLayer.h rename src/servers/app/{ServerScreen.cpp => Screen.cpp} (98%) rename src/servers/app/{ServerScreen.h => Screen.h} (100%) rename src/servers/app/{ViewLayer.cpp => View.cpp} (85%) rename src/servers/app/{ViewLayer.h => View.h} (88%) rename src/servers/app/{WindowLayer.cpp => Window.cpp} (90%) rename src/servers/app/{WindowLayer.h => Window.h} (84%) rename src/servers/app/{WorkspacesLayer.cpp => WorkspacesView.cpp} (89%) rename src/servers/app/{WorkspacesLayer.h => WorkspacesView.h} (73%) diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp index b7e5c62dc5..d63a7cea47 100644 --- a/src/servers/app/Desktop.cpp +++ b/src/servers/app/Desktop.cpp @@ -18,16 +18,16 @@ #include "DrawingEngine.h" #include "HWInterface.h" #include "InputManager.h" +#include "Screen.h" #include "ServerApp.h" #include "ServerConfig.h" #include "ServerCursor.h" -#include "ServerScreen.h" #include "ServerWindow.h" #include "SystemPalette.h" #include "WindowPrivate.h" -#include "WindowLayer.h" +#include "Window.h" #include "Workspace.h" -#include "WorkspacesLayer.h" +#include "WorkspacesView.h" #include #include @@ -239,7 +239,7 @@ MouseFilter::Filter(BMessage* message, EventTarget** _target, int32* _viewToken, int32 viewToken = B_NULL_TOKEN; - WindowLayer* window = fDesktop->MouseEventWindow(); + Window* window = fDesktop->MouseEventWindow(); if (window == NULL) window = fDesktop->WindowAt(where); @@ -667,7 +667,7 @@ Desktop::_ActivateApp(team_id team) // search for an unhidden window to give focus to - for (WindowLayer* window = fAllWindows.FirstWindow(); window != NULL; + for (Window* window = fAllWindows.FirstWindow(); window != NULL; window = window->NextWindow(kAllWindowList)) { // if window is a normal window of the team, and not hidden, // we've found our target @@ -752,13 +752,13 @@ Desktop::RedrawBackground() BRegion redraw; - WindowLayer* window = _CurrentWindows().FirstWindow(); + Window* window = _CurrentWindows().FirstWindow(); if (window->Feel() == kDesktopWindowFeel) { redraw = window->VisibleContentRegion(); // look for desktop background view, and update its background color // TODO: is there a better way to do this? - ViewLayer* view = window->TopLayer(); + View* view = window->TopLayer(); if (view != NULL) view = view->FirstChild(); @@ -909,7 +909,7 @@ Desktop::_SetWorkspace(int32 index) BRegion dirty; - for (WindowLayer* window = _CurrentWindows().FirstWindow(); + for (Window* window = _CurrentWindows().FirstWindow(); window != NULL; window = window->NextWindow(previousIndex)) { // store current position in Workspace anchor window->Anchor(previousIndex).position = window->Frame().LeftTop(); @@ -935,7 +935,7 @@ Desktop::_SetWorkspace(int32 index) WindowList windows(kWorkingList); BList previousRegions; - for (WindowLayer* window = _Windows(index).FirstWindow(); + for (Window* window = _Windows(index).FirstWindow(); window != NULL; window = window->NextWindow(index)) { BPoint position = window->Anchor(index).position; @@ -989,7 +989,7 @@ Desktop::_SetWorkspace(int32 index) _RebuildClippingForAllWindows(stillAvailableOnScreen); _SetBackground(stillAvailableOnScreen); - for (WindowLayer* window = _Windows(index).FirstWindow(); window != NULL; + for (Window* window = _Windows(index).FirstWindow(); window != NULL; window = window->NextWindow(index)) { // send B_WORKSPACE_ACTIVATED message window->WorkspaceActivated(index, true); @@ -1006,7 +1006,7 @@ Desktop::_SetWorkspace(int32 index) // Catch order changes in the new workspaces window list int32 i = 0; - for (WindowLayer* window = windows.FirstWindow(); window != NULL; + for (Window* window = windows.FirstWindow(); window != NULL; window = window->NextWindow(kWorkingList), i++) { BRegion* region = (BRegion*)previousRegions.ItemAt(i); region->ExclusiveInclude(&window->VisibleRegion()); @@ -1066,7 +1066,7 @@ Desktop::ScreenChanged(Screen* screen, bool makeDefault) update.AddInt32("mode", screen->ColorSpace()); // TODO: currently ignores the screen argument! - for (WindowLayer* window = fAllWindows.FirstWindow(); window != NULL; + for (Window* window = fAllWindows.FirstWindow(); window != NULL; window = window->NextWindow(kAllWindowList)) { window->ServerWindow()->SendMessageToClient(&update); } @@ -1085,7 +1085,7 @@ Desktop::ScreenChanged(Screen* screen, bool makeDefault) } -// #pragma mark - Methods for WindowLayer manipulation +// #pragma mark - Methods for Window manipulation WindowList& @@ -1104,14 +1104,14 @@ Desktop::_Windows(int32 index) void Desktop::_UpdateFloating(int32 previousWorkspace, int32 nextWorkspace, - WindowLayer* mouseEventWindow) + Window* mouseEventWindow) { if (previousWorkspace == -1) previousWorkspace = fCurrentWorkspace; if (nextWorkspace == -1) nextWorkspace = previousWorkspace; - for (WindowLayer* floating = fSubsetWindows.FirstWindow(); floating != NULL; + for (Window* floating = fSubsetWindows.FirstWindow(); floating != NULL; floating = floating->NextWindow(kSubsetList)) { // we only care about app/subset floating windows if (floating->Feel() != B_FLOATING_SUBSET_WINDOW_FEEL @@ -1161,7 +1161,7 @@ Desktop::_UpdateBack() { fBack = NULL; - for (WindowLayer* window = _CurrentWindows().FirstWindow(); + for (Window* window = _CurrentWindows().FirstWindow(); window != NULL; window = window->NextWindow(fCurrentWorkspace)) { if (window->IsHidden() || window->Feel() == kDesktopWindowFeel) continue; @@ -1185,7 +1185,7 @@ Desktop::_UpdateFront(bool updateFloating) { fFront = NULL; - for (WindowLayer* window = _CurrentWindows().LastWindow(); + for (Window* window = _CurrentWindows().LastWindow(); window != NULL; window = window->PreviousWindow(fCurrentWorkspace)) { if (window->IsHidden() || window->IsFloating() || !window->SupportsFront()) continue; @@ -1215,7 +1215,7 @@ Desktop::_UpdateFronts(bool updateFloating) EventTarget* Desktop::KeyboardEventTarget() { - WindowLayer* window = _CurrentWindows().LastWindow(); + Window* window = _CurrentWindows().LastWindow(); while (window != NULL && window->IsHidden()) { window = window->PreviousWindow(fCurrentWorkspace); } @@ -1230,12 +1230,12 @@ Desktop::KeyboardEventTarget() bool -Desktop::_WindowHasModal(WindowLayer* window) +Desktop::_WindowHasModal(Window* window) { if (window == NULL) return false; - for (WindowLayer* modal = fSubsetWindows.FirstWindow(); modal != NULL; + for (Window* modal = fSubsetWindows.FirstWindow(); modal != NULL; modal = modal->NextWindow(kSubsetList)) { // only visible modal windows count if (!modal->IsModal() || modal->IsHidden()) @@ -1253,10 +1253,10 @@ Desktop::_WindowHasModal(WindowLayer* window) You must at least hold a single window lock when calling this method. */ void -Desktop::_WindowChanged(WindowLayer* window) +Desktop::_WindowChanged(Window* window) { for (uint32 i = fWorkspacesViews.CountItems(); i-- > 0;) { - WorkspacesLayer* view = fWorkspacesViews.ItemAt(i); + WorkspacesView* view = fWorkspacesViews.ItemAt(i); view->WindowChanged(window); } } @@ -1266,17 +1266,17 @@ Desktop::_WindowChanged(WindowLayer* window) You must at least hold a single window lock when calling this method. */ void -Desktop::_WindowRemoved(WindowLayer* window) +Desktop::_WindowRemoved(Window* window) { for (uint32 i = fWorkspacesViews.CountItems(); i-- > 0;) { - WorkspacesLayer* view = fWorkspacesViews.ItemAt(i); + WorkspacesView* view = fWorkspacesViews.ItemAt(i); view->WindowRemoved(window); } } void -Desktop::AddWorkspacesView(WorkspacesLayer* view) +Desktop::AddWorkspacesView(WorkspacesView* view) { if (view->Window() == NULL || view->Window()->IsHidden()) return; @@ -1291,7 +1291,7 @@ Desktop::AddWorkspacesView(WorkspacesLayer* view) void -Desktop::RemoveWorkspacesView(WorkspacesLayer* view) +Desktop::RemoveWorkspacesView(WorkspacesView* view) { if (!LockAllWindows()) return; @@ -1311,7 +1311,7 @@ Desktop::RemoveWorkspacesView(WorkspacesLayer* view) Windows must not be locked when calling this method. */ void -Desktop::_SendFakeMouseMoved(WindowLayer* window) +Desktop::_SendFakeMouseMoved(Window* window) { int32 viewToken = B_NULL_TOKEN; EventTarget* target = NULL; @@ -1346,7 +1346,7 @@ Desktop::_SendFakeMouseMoved(WindowLayer* window) void -Desktop::SetFocusWindow(WindowLayer* focus) +Desktop::SetFocusWindow(Window* focus) { if (!LockAllWindows()) return; @@ -1445,7 +1445,7 @@ Desktop::_BringWindowsToFront(WindowList& windows, int32 list, // visible of the window BRegion clean; - for (WindowLayer* window = windows.FirstWindow(); window != NULL; + for (Window* window = windows.FirstWindow(); window != NULL; window = window->NextWindow(list)) { if (wereVisible) clean.Include(&window->VisibleRegion()); @@ -1463,7 +1463,7 @@ Desktop::_BringWindowsToFront(WindowList& windows, int32 list, // redraw what became visible of the window(s) BRegion dirty; - for (WindowLayer* window = windows.FirstWindow(); window != NULL; + for (Window* window = windows.FirstWindow(); window != NULL; window = window->NextWindow(list)) { dirty.Include(&window->VisibleRegion()); } @@ -1487,7 +1487,7 @@ Desktop::_BringWindowsToFront(WindowList& windows, int32 list, of their subset. */ void -Desktop::ActivateWindow(WindowLayer* window) +Desktop::ActivateWindow(Window* window) { STRACE(("ActivateWindow(%p, %s)\n", window, window ? window->Title() : "")); @@ -1533,7 +1533,7 @@ Desktop::ActivateWindow(WindowLayer* window) if (window == FrontWindow()) { // see if there is a normal B_AVOID_FRONT window still in front of us - WindowLayer* avoidsFront = window->NextWindow(fCurrentWorkspace); + Window* avoidsFront = window->NextWindow(fCurrentWorkspace); while (avoidsFront && avoidsFront->IsNormal() && (avoidsFront->Flags() & B_AVOID_FRONT) == 0) { avoidsFront = avoidsFront->NextWindow(fCurrentWorkspace); @@ -1554,7 +1554,7 @@ Desktop::ActivateWindow(WindowLayer* window) BRegion clean(window->VisibleRegion()); WindowList windows(kWorkingList); - WindowLayer* frontmost = window->Frontmost(); + Window* frontmost = window->Frontmost(); _CurrentWindows().RemoveWindow(window); windows.AddWindow(window); @@ -1564,8 +1564,8 @@ Desktop::ActivateWindow(WindowLayer* window) // (ie. they are staying in front of them, but they are // not supposed to change their order because of that) - WindowLayer* nextModal; - for (WindowLayer* modal = frontmost; modal != NULL; modal = nextModal) { + Window* nextModal; + for (Window* modal = frontmost; modal != NULL; modal = nextModal) { // get the next modal window nextModal = modal->NextWindow(fCurrentWorkspace); while (nextModal != NULL && !nextModal->IsModal()) { @@ -1588,7 +1588,7 @@ Desktop::ActivateWindow(WindowLayer* window) void -Desktop::SendWindowBehind(WindowLayer* window, WindowLayer* behindOf) +Desktop::SendWindowBehind(Window* window, Window* behindOf) { // TODO: should the "not in current workspace" be handled anyway? // (the code below would have to be changed then, though) @@ -1607,7 +1607,7 @@ Desktop::SendWindowBehind(WindowLayer* window, WindowLayer* behindOf) BRegion dirty(window->VisibleRegion()); // detach window and re-attach at desired position - WindowLayer* backmost = window->Backmost(behindOf); + Window* backmost = window->Backmost(behindOf); _CurrentWindows().RemoveWindow(window); _CurrentWindows().AddWindow(window, backmost @@ -1639,7 +1639,7 @@ Desktop::SendWindowBehind(WindowLayer* window, WindowLayer* behindOf) void -Desktop::ShowWindow(WindowLayer* window) +Desktop::ShowWindow(Window* window) { if (!window->IsHidden()) return; @@ -1676,7 +1676,7 @@ Desktop::ShowWindow(WindowLayer* window) void -Desktop::HideWindow(WindowLayer* window) +Desktop::HideWindow(Window* window) { if (window->IsHidden()) return; @@ -1704,10 +1704,10 @@ Desktop::HideWindow(WindowLayer* window) if (window->HasWorkspacesViews()) { // remove workspaces views from this window - BObjectList list(false); + BObjectList list(false); window->FindWorkspacesViews(list); - while (WorkspacesLayer* view = list.RemoveItemAt(0)) { + while (WorkspacesView* view = list.RemoveItemAt(0)) { fWorkspacesViews.RemoveItem(view); } } @@ -1721,10 +1721,10 @@ Desktop::HideWindow(WindowLayer* window) /*! Shows the window on the screen - it does this independently of the - WindowLayer::IsHidden() state. + Window::IsHidden() state. */ void -Desktop::_ShowWindow(WindowLayer* window, bool affectsOtherWindows) +Desktop::_ShowWindow(Window* window, bool affectsOtherWindows) { BRegion background; _RebuildClippingForAllWindows(background); @@ -1746,10 +1746,10 @@ Desktop::_ShowWindow(WindowLayer* window, bool affectsOtherWindows) /*! Hides the window from the screen - it does this independently of the - WindowLayer::IsHidden() state. + Window::IsHidden() state. */ void -Desktop::_HideWindow(WindowLayer* window) +Desktop::_HideWindow(Window* window) { // after rebuilding the clipping, // this window will not have a visible @@ -1770,7 +1770,7 @@ Desktop::_HideWindow(WindowLayer* window) void -Desktop::MoveWindowBy(WindowLayer* window, float x, float y, int32 workspace) +Desktop::MoveWindowBy(Window* window, float x, float y, int32 workspace) { if (!LockAllWindows()) return; @@ -1836,7 +1836,7 @@ Desktop::MoveWindowBy(WindowLayer* window, float x, float y, int32 workspace) void -Desktop::ResizeWindowBy(WindowLayer* window, float x, float y) +Desktop::ResizeWindowBy(Window* window, float x, float y) { if (!LockAllWindows()) return; @@ -1877,7 +1877,7 @@ Desktop::ResizeWindowBy(WindowLayer* window, float x, float y) bool -Desktop::SetWindowTabLocation(WindowLayer* window, float location) +Desktop::SetWindowTabLocation(Window* window, float location) { if (!LockAllWindows()) return false; @@ -1901,8 +1901,7 @@ Desktop::SetWindowTabLocation(WindowLayer* window, float location) bool -Desktop::SetWindowDecoratorSettings(WindowLayer* window, - const BMessage& settings) +Desktop::SetWindowDecoratorSettings(Window* window, const BMessage& settings) { // TODO: almost exact code duplication to above function... @@ -1934,7 +1933,7 @@ Desktop::SetWindowDecoratorSettings(WindowLayer* window, SetWorkspace(). */ void -Desktop::_UpdateSubsetWorkspaces(WindowLayer* window, int32 previousIndex, +Desktop::_UpdateSubsetWorkspaces(Window* window, int32 previousIndex, int32 newIndex) { STRACE(("_UpdateSubsetWorkspaces(window %p, %s)\n", window, window->Title())); @@ -1943,7 +1942,7 @@ Desktop::_UpdateSubsetWorkspaces(WindowLayer* window, int32 previousIndex, if (!window->IsNormal() || window->IsHidden()) return; - for (WindowLayer* subset = fSubsetWindows.FirstWindow(); subset != NULL; + for (Window* subset = fSubsetWindows.FirstWindow(); subset != NULL; subset = subset->NextWindow(kSubsetList)) { if (subset->Feel() == B_MODAL_ALL_WINDOW_FEEL || subset->Feel() == B_FLOATING_ALL_WINDOW_FEEL) { @@ -1975,7 +1974,7 @@ Desktop::_UpdateSubsetWorkspaces(WindowLayer* window, int32 previousIndex, \brief Adds or removes the window to or from the workspaces it's on. */ void -Desktop::_ChangeWindowWorkspaces(WindowLayer* window, uint32 oldWorkspaces, +Desktop::_ChangeWindowWorkspaces(Window* window, uint32 oldWorkspaces, uint32 newWorkspaces) { // apply changes to the workspaces' window lists @@ -2025,7 +2024,7 @@ Desktop::_ChangeWindowWorkspaces(WindowLayer* window, uint32 oldWorkspaces, void -Desktop::SetWindowWorkspaces(WindowLayer* window, uint32 workspaces) +Desktop::SetWindowWorkspaces(Window* window, uint32 workspaces) { LockAllWindows(); @@ -2046,7 +2045,7 @@ Desktop::SetWindowWorkspaces(WindowLayer* window, uint32 workspaces) via ShowWindow(). */ void -Desktop::AddWindow(WindowLayer *window) +Desktop::AddWindow(Window *window) { LockAllWindows(); @@ -2068,7 +2067,7 @@ Desktop::AddWindow(WindowLayer *window) void -Desktop::RemoveWindow(WindowLayer *window) +Desktop::RemoveWindow(Window *window) { LockAllWindows(); @@ -2089,7 +2088,7 @@ Desktop::RemoveWindow(WindowLayer *window) bool -Desktop::AddWindowToSubset(WindowLayer* subset, WindowLayer* window) +Desktop::AddWindowToSubset(Window* subset, Window* window) { if (!subset->AddToSubset(window)) return false; @@ -2100,7 +2099,7 @@ Desktop::AddWindowToSubset(WindowLayer* subset, WindowLayer* window) void -Desktop::RemoveWindowFromSubset(WindowLayer* subset, WindowLayer* window) +Desktop::RemoveWindowFromSubset(Window* subset, Window* window) { subset->RemoveFromSubset(window); _ChangeWindowWorkspaces(subset, subset->Workspaces(), subset->SubsetWorkspaces()); @@ -2108,7 +2107,7 @@ Desktop::RemoveWindowFromSubset(WindowLayer* subset, WindowLayer* window) void -Desktop::SetWindowLook(WindowLayer *window, window_look newLook) +Desktop::SetWindowLook(Window *window, window_look newLook) { if (window->Look() == newLook) return; @@ -2133,7 +2132,7 @@ Desktop::SetWindowLook(WindowLayer *window, window_look newLook) void -Desktop::SetWindowFeel(WindowLayer *window, window_feel newFeel) +Desktop::SetWindowFeel(Window *window, window_feel newFeel) { if (window->Feel() == newFeel) return; @@ -2168,10 +2167,10 @@ Desktop::SetWindowFeel(WindowLayer *window, window_feel newFeel) if (i == fCurrentWorkspace && window->IsVisible()) visibleBefore = window->VisibleRegion(); - WindowLayer* backmost = window->Backmost(_Windows(i).LastWindow(), i); + Window* backmost = window->Backmost(_Windows(i).LastWindow(), i); if (backmost != NULL) { // check if the backmost window is really behind it - WindowLayer* previous = window->PreviousWindow(i); + Window* previous = window->PreviousWindow(i); while (previous != NULL) { if (previous == backmost) break; @@ -2187,10 +2186,10 @@ Desktop::SetWindowFeel(WindowLayer *window, window_feel newFeel) } } - WindowLayer* frontmost = window->Frontmost(_Windows(i).FirstWindow(), i); + Window* frontmost = window->Frontmost(_Windows(i).FirstWindow(), i); if (frontmost != NULL) { // check if the frontmost window is really in front of it - WindowLayer* next = window->NextWindow(i); + Window* next = window->NextWindow(i); while (next != NULL) { if (next == frontmost) break; @@ -2232,7 +2231,7 @@ Desktop::SetWindowFeel(WindowLayer *window, window_feel newFeel) void -Desktop::SetWindowFlags(WindowLayer *window, uint32 newFlags) +Desktop::SetWindowFlags(Window *window, uint32 newFlags) { if (window->Flags() == newFlags) return; @@ -2257,7 +2256,7 @@ Desktop::SetWindowFlags(WindowLayer *window, uint32 newFlags) void -Desktop::SetWindowTitle(WindowLayer *window, const char* title) +Desktop::SetWindowTitle(Window *window, const char* title) { if (!LockAllWindows()) return; @@ -2281,10 +2280,10 @@ Desktop::SetWindowTitle(WindowLayer *window, const char* title) Returns the window under the mouse cursor. You need to have acquired the All Windows lock when calling this method. */ -WindowLayer* +Window* Desktop::WindowAt(BPoint where) { - for (WindowLayer* window = _CurrentWindows().LastWindow(); window; + for (Window* window = _CurrentWindows().LastWindow(); window; window = window->PreviousWindow(fCurrentWorkspace)) { if (window->IsVisible() && window->VisibleRegion().Contains(where)) return window; @@ -2295,14 +2294,14 @@ Desktop::WindowAt(BPoint where) void -Desktop::SetMouseEventWindow(WindowLayer* window) +Desktop::SetMouseEventWindow(Window* window) { fMouseEventWindow = window; } void -Desktop::SetViewUnderMouse(const WindowLayer* window, int32 viewToken) +Desktop::SetViewUnderMouse(const Window* window, int32 viewToken) { fWindowUnderMouse = window; fViewUnderMouse = viewToken; @@ -2310,7 +2309,7 @@ Desktop::SetViewUnderMouse(const WindowLayer* window, int32 viewToken) int32 -Desktop::ViewUnderMouse(const WindowLayer* window) +Desktop::ViewUnderMouse(const Window* window) { if (window != NULL && fWindowUnderMouse == window) return fViewUnderMouse; @@ -2319,10 +2318,10 @@ Desktop::ViewUnderMouse(const WindowLayer* window) } -WindowLayer * -Desktop::FindWindowLayerByClientToken(int32 token, team_id teamID) +Window * +Desktop::FindWindowByClientToken(int32 token, team_id teamID) { - for (WindowLayer *window = fAllWindows.FirstWindow(); window != NULL; + for (Window *window = fAllWindows.FirstWindow(); window != NULL; window = window->NextWindow(kAllWindowList)) { if (window->ServerWindow()->ClientToken() == token && window->ServerWindow()->ClientTeam() == teamID) { @@ -2341,7 +2340,7 @@ Desktop::MinimizeApplication(team_id team) // Just minimize all windows of that application - for (WindowLayer *window = fAllWindows.FirstWindow(); window != NULL; + for (Window *window = fAllWindows.FirstWindow(); window != NULL; window = window->NextWindow(kAllWindowList)) { if (window->ServerWindow()->ClientTeam() != team) continue; @@ -2358,7 +2357,7 @@ Desktop::BringApplicationToFront(team_id team) // TODO: for now, just maximize all windows of that application - for (WindowLayer *window = fAllWindows.FirstWindow(); window != NULL; + for (Window *window = fAllWindows.FirstWindow(); window != NULL; window = window->NextWindow(kAllWindowList)) { if (window->ServerWindow()->ClientTeam() != team) continue; @@ -2377,7 +2376,7 @@ Desktop::WindowAction(int32 windowToken, int32 action) LockAllWindows(); ::ServerWindow* serverWindow; - WindowLayer* window; + Window* window; if (BPrivate::gDefaultTokens.GetToken(windowToken, B_SERVER_TOKEN, (void**)&serverWindow) != B_OK || (window = serverWindow->Window()) == NULL) { @@ -2405,7 +2404,7 @@ Desktop::WriteWindowList(team_id team, BPrivate::LinkSender& sender) int32 count = 0; - for (WindowLayer *window = fAllWindows.FirstWindow(); window != NULL; + for (Window *window = fAllWindows.FirstWindow(); window != NULL; window = window->NextWindow(kAllWindowList)) { if (team < B_OK || window->ServerWindow()->ClientTeam() == team) count++; @@ -2416,7 +2415,7 @@ Desktop::WriteWindowList(team_id team, BPrivate::LinkSender& sender) sender.StartMessage(B_OK); sender.Attach(count); - for (WindowLayer *window = fAllWindows.FirstWindow(); window != NULL; + for (Window *window = fAllWindows.FirstWindow(); window != NULL; window = window->NextWindow(kAllWindowList)) { if (team >= B_OK && window->ServerWindow()->ClientTeam() != team) continue; @@ -2483,7 +2482,7 @@ Desktop::_RebuildClippingForAllWindows(BRegion& stillAvailableOnScreen) stillAvailableOnScreen = fScreenRegion; // set clipping of each window - for (WindowLayer* window = _CurrentWindows().LastWindow(); window != NULL; + for (Window* window = _CurrentWindows().LastWindow(); window != NULL; window = window->PreviousWindow(fCurrentWorkspace)) { if (!window->IsHidden()) { window->SetClipping(&stillAvailableOnScreen); @@ -2498,7 +2497,7 @@ void Desktop::_TriggerWindowRedrawing(BRegion& newDirtyRegion) { // send redraw messages to all windows intersecting the dirty region - for (WindowLayer* window = _CurrentWindows().LastWindow(); window != NULL; + for (Window* window = _CurrentWindows().LastWindow(); window != NULL; window = window->PreviousWindow(fCurrentWorkspace)) { if (!window->IsHidden() && newDirtyRegion.Intersects(window->VisibleRegion().Frame())) diff --git a/src/servers/app/Desktop.h b/src/servers/app/Desktop.h index 4903ac64a0..3a21a50b61 100644 --- a/src/servers/app/Desktop.h +++ b/src/servers/app/Desktop.h @@ -13,8 +13,8 @@ #include "CursorManager.h" #include "EventDispatcher.h" +#include "Screen.h" #include "ScreenManager.h" -#include "ServerScreen.h" #include "VirtualScreen.h" #include "DesktopSettings.h" #include "MessageLooper.h" @@ -44,7 +44,8 @@ class BMessage; class DrawingEngine; class HWInterface; class ServerApp; -class WorkspacesLayer; +class Window; +class WorkspacesView; struct server_read_only_memory; namespace BPrivate { @@ -109,55 +110,55 @@ class Desktop : public MessageLooper, public ScreenOwner { { return fWorkspaces[index]; } status_t SetWorkspacesCount(int32 newCount); - // WindowLayer methods + // Window methods - void ActivateWindow(WindowLayer* window); - void SendWindowBehind(WindowLayer* window, - WindowLayer* behindOf = NULL); + void ActivateWindow(Window* window); + void SendWindowBehind(Window* window, + Window* behindOf = NULL); - void ShowWindow(WindowLayer* window); - void HideWindow(WindowLayer* window); + void ShowWindow(Window* window); + void HideWindow(Window* window); - void MoveWindowBy(WindowLayer* window, float x, float y, + void MoveWindowBy(Window* window, float x, float y, int32 workspace = -1); - void ResizeWindowBy(WindowLayer* window, float x, float y); - bool SetWindowTabLocation(WindowLayer* window, float location); - bool SetWindowDecoratorSettings(WindowLayer* window, + void ResizeWindowBy(Window* window, float x, float y); + bool SetWindowTabLocation(Window* window, float location); + bool SetWindowDecoratorSettings(Window* window, const BMessage& settings); - void SetWindowWorkspaces(WindowLayer* window, + void SetWindowWorkspaces(Window* window, uint32 workspaces); - void AddWindow(WindowLayer* window); - void RemoveWindow(WindowLayer* window); + void AddWindow(Window* window); + void RemoveWindow(Window* window); - bool AddWindowToSubset(WindowLayer* subset, - WindowLayer* window); - void RemoveWindowFromSubset(WindowLayer* subset, - WindowLayer* window); + bool AddWindowToSubset(Window* subset, + Window* window); + void RemoveWindowFromSubset(Window* subset, + Window* window); - void SetWindowLook(WindowLayer* window, window_look look); - void SetWindowFeel(WindowLayer* window, window_feel feel); - void SetWindowFlags(WindowLayer* window, uint32 flags); - void SetWindowTitle(WindowLayer* window, const char* title); + void SetWindowLook(Window* window, window_look look); + void SetWindowFeel(Window* window, window_feel feel); + void SetWindowFlags(Window* window, uint32 flags); + void SetWindowTitle(Window* window, const char* title); - WindowLayer* FocusWindow() const { return fFocus; } - WindowLayer* FrontWindow() const { return fFront; } - WindowLayer* BackWindow() const { return fBack; } + Window* FocusWindow() const { return fFocus; } + Window* FrontWindow() const { return fFront; } + Window* BackWindow() const { return fBack; } - WindowLayer* WindowAt(BPoint where); + Window* WindowAt(BPoint where); - WindowLayer* MouseEventWindow() const { return fMouseEventWindow; } - void SetMouseEventWindow(WindowLayer* window); + Window* MouseEventWindow() const { return fMouseEventWindow; } + void SetMouseEventWindow(Window* window); - void SetViewUnderMouse(const WindowLayer* window, int32 viewToken); - int32 ViewUnderMouse(const WindowLayer* window); + void SetViewUnderMouse(const Window* window, int32 viewToken); + int32 ViewUnderMouse(const Window* window); - void SetFocusWindow(WindowLayer* window = NULL); + void SetFocusWindow(Window* window = NULL); EventTarget* KeyboardEventTarget(); - WindowLayer* FindWindowLayerByClientToken(int32 token, team_id teamID); - //WindowLayer* FindWindowLayerByServerToken(int32 token); + Window* FindWindowByClientToken(int32 token, + team_id teamID); #if USE_MULTI_LOCKER bool LockSingleWindow() { return fWindowLock.ReadLock(); } @@ -181,8 +182,8 @@ class Desktop : public MessageLooper, public ScreenOwner { void RedrawBackground(); void StoreWorkspaceConfiguration(int32 index); - void AddWorkspacesView(WorkspacesLayer* view); - void RemoveWorkspacesView(WorkspacesLayer* view); + void AddWorkspacesView(WorkspacesView* view); + void RemoveWorkspacesView(WorkspacesView* view); void MinimizeApplication(team_id team); void BringApplicationToFront(team_id team); @@ -196,19 +197,19 @@ class Desktop : public MessageLooper, public ScreenOwner { private: void _LaunchInputServer(); void _SetWorkspace(int32 index); - void _ShowWindow(WindowLayer* window, + void _ShowWindow(Window* window, bool affectsOtherWindows = true); - void _HideWindow(WindowLayer* window); + void _HideWindow(Window* window); - void _UpdateSubsetWorkspaces(WindowLayer* window, + void _UpdateSubsetWorkspaces(Window* window, int32 previousIndex = -1, int32 newIndex = -1); - void _ChangeWindowWorkspaces(WindowLayer* window, + void _ChangeWindowWorkspaces(Window* window, uint32 oldWorkspaces, uint32 newWorkspaces); void _BringWindowsToFront(WindowList& windows, int32 list, bool wereVisible); status_t _ActivateApp(team_id team); - void _SendFakeMouseMoved(WindowLayer* window = NULL); + void _SendFakeMouseMoved(Window* window = NULL); void _RebuildClippingForAllWindows(BRegion& stillAvailableOnScreen); void _TriggerWindowRedrawing(BRegion& newDirtyRegion); @@ -216,14 +217,14 @@ class Desktop : public MessageLooper, public ScreenOwner { void _UpdateFloating(int32 previousWorkspace = -1, int32 nextWorkspace = -1, - WindowLayer* mouseEventWindow = NULL); + Window* mouseEventWindow = NULL); void _UpdateBack(); void _UpdateFront(bool updateFloating = true); void _UpdateFronts(bool updateFloating = true); - bool _WindowHasModal(WindowLayer* window); + bool _WindowHasModal(Window* window); - void _WindowChanged(WindowLayer* window); - void _WindowRemoved(WindowLayer* window); + void _WindowChanged(Window* window); + void _WindowRemoved(Window* window); void _GetLooperName(char* name, size_t size); void _PrepareQuit(); @@ -258,7 +259,7 @@ class Desktop : public MessageLooper, public ScreenOwner { WindowList fAllWindows; WindowList fSubsetWindows; WindowList fFocusList; - BObjectList fWorkspacesViews; + BObjectList fWorkspacesViews; Screen* fActiveScreen; @@ -273,15 +274,15 @@ class Desktop : public MessageLooper, public ScreenOwner { BRegion fBackgroundRegion; BRegion fScreenRegion; - WindowLayer* fMouseEventWindow; - const WindowLayer* fWindowUnderMouse; + Window* fMouseEventWindow; + const Window* fWindowUnderMouse; int32 fViewUnderMouse; BPoint fLastMousePosition; int32 fLastMouseButtons; - WindowLayer* fFocus; - WindowLayer* fFront; - WindowLayer* fBack; + Window* fFocus; + Window* fFront; + Window* fBack; }; #endif // DESKTOP_H diff --git a/src/servers/app/Jamfile b/src/servers/app/Jamfile index 13517a225d..e697117959 100644 --- a/src/servers/app/Jamfile +++ b/src/servers/app/Jamfile @@ -39,27 +39,27 @@ Server app_server : MessageLooper.cpp MultiLocker.cpp OffscreenServerWindow.cpp - OffscreenWindowLayer.cpp + OffscreenWindow.cpp PNGDump.cpp ProfileMessageSupport.cpp RAMLinkMsgReader.cpp RGBColor.cpp RegionPool.cpp + Screen.cpp ScreenManager.cpp ServerApp.cpp ServerBitmap.cpp ServerCursor.cpp ServerFont.cpp ServerPicture.cpp - ServerScreen.cpp ServerWindow.cpp SystemPalette.cpp - ViewLayer.cpp + View.cpp VirtualScreen.cpp - WindowLayer.cpp + Window.cpp WindowList.cpp Workspace.cpp - WorkspacesLayer.cpp + WorkspacesView.cpp # libraries : diff --git a/src/servers/app/OffscreenServerWindow.cpp b/src/servers/app/OffscreenServerWindow.cpp index 8797ebd287..96c39090b4 100644 --- a/src/servers/app/OffscreenServerWindow.cpp +++ b/src/servers/app/OffscreenServerWindow.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2005, Haiku, Inc. All rights reserved. + * Copyright 2005-2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -7,32 +7,29 @@ */ -#include "OffscreenWindowLayer.h" +#include "OffscreenWindow.h" #include "ServerBitmap.h" #include "OffscreenServerWindow.h" -OffscreenServerWindow::OffscreenServerWindow(const char *title, - ServerApp *app, - port_id clientPort, - port_id looperPort, - int32 handlerID, - ServerBitmap* bitmap) +OffscreenServerWindow::OffscreenServerWindow(const char *title, ServerApp *app, + port_id clientPort, port_id looperPort, int32 handlerID, + ServerBitmap* bitmap) : ServerWindow(title, app, clientPort, looperPort, handlerID), - fBitmap(bitmap) + fBitmap(bitmap) { } -// destructor + OffscreenServerWindow::~OffscreenServerWindow() { } -// SendMessageToClient + void OffscreenServerWindow::SendMessageToClient(const BMessage* msg, int32 target, - bool usePreferred) const + bool usePreferred) const { // We're a special kind of window. The client BWindow thread is not running, // so we cannot post messages to the client. In order to not mess arround @@ -41,9 +38,9 @@ OffscreenServerWindow::SendMessageToClient(const BMessage* msg, int32 target, } -WindowLayer* -OffscreenServerWindow::MakeWindowLayer(BRect frame, const char* name, +Window* +OffscreenServerWindow::MakeWindow(BRect frame, const char* name, window_look look, window_feel feel, uint32 flags, uint32 workspace) { - return new OffscreenWindowLayer(fBitmap, name, this); + return new OffscreenWindow(fBitmap, name, this); } diff --git a/src/servers/app/OffscreenServerWindow.h b/src/servers/app/OffscreenServerWindow.h index e65f38ecd0..34e3d522f3 100644 --- a/src/servers/app/OffscreenServerWindow.h +++ b/src/servers/app/OffscreenServerWindow.h @@ -1,5 +1,5 @@ /* - * Copyright 2005, Haiku, Inc. All rights reserved. + * Copyright 2005-2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -13,26 +13,23 @@ class OffscreenServerWindow : public ServerWindow { - public: - OffscreenServerWindow(const char *title, - ServerApp *app, - port_id clientPort, - port_id looperPort, - int32 handlerID, - ServerBitmap* bitmap); - virtual ~OffscreenServerWindow(); +public: + OffscreenServerWindow(const char *title, ServerApp *app, + port_id clientPort, port_id looperPort, + int32 handlerID, ServerBitmap* bitmap); + virtual ~OffscreenServerWindow(); // util methods. - virtual void SendMessageToClient(const BMessage* msg, - int32 target = B_NULL_TOKEN, - bool usePreferred = false) const; + virtual void SendMessageToClient(const BMessage* msg, + int32 target = B_NULL_TOKEN, + bool usePreferred = false) const; - virtual WindowLayer* MakeWindowLayer(BRect frame, const char* name, - window_look look, window_feel feel, uint32 flags, - uint32 workspace); + virtual ::Window* MakeWindow(BRect frame, const char* name, + window_look look, window_feel feel, uint32 flags, + uint32 workspace); - private: - ServerBitmap* fBitmap; +private: + ServerBitmap* fBitmap; }; #endif // OFFSCREEN_SERVER_WINDOW_H diff --git a/src/servers/app/OffscreenWindowLayer.cpp b/src/servers/app/OffscreenWindow.cpp similarity index 74% rename from src/servers/app/OffscreenWindowLayer.cpp rename to src/servers/app/OffscreenWindow.cpp index b51bb50da3..a58d7452e8 100644 --- a/src/servers/app/OffscreenWindowLayer.cpp +++ b/src/servers/app/OffscreenWindow.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2005, Haiku, Inc. All rights reserved. + * Copyright 2005-2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT license. * * Author: @@ -7,24 +7,25 @@ */ -#include "BitmapHWInterface.h" -#include "DrawingEngine.h" -#include "OffscreenWindowLayer.h" -#include "ServerBitmap.h" - -#include -#include "DebugInfoManager.h" +#include "OffscreenWindow.h" #include +#include -OffscreenWindowLayer::OffscreenWindowLayer(ServerBitmap* bitmap, +#include "BitmapHWInterface.h" +#include "DebugInfoManager.h" +#include "DrawingEngine.h" +#include "ServerBitmap.h" + + +OffscreenWindow::OffscreenWindow(ServerBitmap* bitmap, const char* name, ::ServerWindow* window) - : WindowLayer(bitmap->Bounds(), name, + : Window(bitmap->Bounds(), name, B_NO_BORDER_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, 0, 0, window, new DrawingEngine()), - fBitmap(bitmap), - fHWInterface(new BitmapHWInterface(fBitmap)) + fBitmap(bitmap), + fHWInterface(new BitmapHWInterface(fBitmap)) { fHWInterface->Initialize(); GetDrawingEngine()->SetHWInterface(fHWInterface); @@ -37,7 +38,7 @@ OffscreenWindowLayer::OffscreenWindowLayer(ServerBitmap* bitmap, } -OffscreenWindowLayer::~OffscreenWindowLayer() +OffscreenWindow::~OffscreenWindow() { fHWInterface->LockExclusiveAccess(); // Unlike normal Layers, we own the DrawingEngine instance diff --git a/src/servers/app/OffscreenWindow.h b/src/servers/app/OffscreenWindow.h new file mode 100644 index 0000000000..42e77647ce --- /dev/null +++ b/src/servers/app/OffscreenWindow.h @@ -0,0 +1,32 @@ +/* + * Copyright 2005-2008, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT license. + * + * Author: + * Stephan Aßmus + */ +#ifndef OFFSCREEN_WINDOW_H +#define OFFSCREEN_WINDOW_H + + +#include "Window.h" + + +class BitmapHWInterface; +class ServerBitmap; + +class OffscreenWindow : public Window { +public: + OffscreenWindow(ServerBitmap* bitmap, + const char* name, ::ServerWindow* window); + virtual ~OffscreenWindow(); + + virtual bool IsOffscreenWindow() const + { return true; } + +private: + ServerBitmap* fBitmap; + BitmapHWInterface* fHWInterface; +}; + +#endif // OFFSCREEN_WINDOW_H diff --git a/src/servers/app/OffscreenWindowLayer.h b/src/servers/app/OffscreenWindowLayer.h deleted file mode 100644 index 4484a13c1d..0000000000 --- a/src/servers/app/OffscreenWindowLayer.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2005, Haiku, Inc. All rights reserved. - * Distributed under the terms of the MIT license. - * - * Author: - * Stephan Aßmus - */ -#ifndef OFFSCREEN_WINBORDER_H -#define OFFSCREEN_WINBORDER_H - - -#include "WindowLayer.h" - - -class BitmapHWInterface; -class ServerBitmap; - -class OffscreenWindowLayer : public WindowLayer { - public: - OffscreenWindowLayer(ServerBitmap* bitmap, - const char* name, - ::ServerWindow* window); - virtual ~OffscreenWindowLayer(); - - virtual bool IsOffscreenWindow() const - { return true; } - - private: - ServerBitmap* fBitmap; - BitmapHWInterface* fHWInterface; -}; - -#endif // OFFSCREEN_WINBORDER_H diff --git a/src/servers/app/ServerScreen.cpp b/src/servers/app/Screen.cpp similarity index 98% rename from src/servers/app/ServerScreen.cpp rename to src/servers/app/Screen.cpp index a988489878..5703622a1a 100644 --- a/src/servers/app/ServerScreen.cpp +++ b/src/servers/app/Screen.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2007, Haiku, Inc. + * Copyright (c) 2001-2008, Haiku, Inc. * Distributed under the terms of the MIT license. * * Authors: @@ -9,7 +9,7 @@ */ -#include "ServerScreen.h" +#include "Screen.h" #include "BitmapManager.h" #include "DrawingEngine.h" diff --git a/src/servers/app/ServerScreen.h b/src/servers/app/Screen.h similarity index 100% rename from src/servers/app/ServerScreen.h rename to src/servers/app/Screen.h diff --git a/src/servers/app/ScreenManager.cpp b/src/servers/app/ScreenManager.cpp index fb504a9e61..0df01b3f4f 100644 --- a/src/servers/app/ScreenManager.cpp +++ b/src/servers/app/ScreenManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2005, Haiku. + * Copyright 2005-2008, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -11,8 +11,8 @@ #include "ScreenManager.h" +#include "Screen.h" #include "ServerConfig.h" -#include "ServerScreen.h" #include #include diff --git a/src/servers/app/ServerApp.cpp b/src/servers/app/ServerApp.cpp index 133e674598..75cedd2ddd 100644 --- a/src/servers/app/ServerApp.cpp +++ b/src/servers/app/ServerApp.cpp @@ -30,16 +30,16 @@ #include "InputManager.h" #include "OffscreenServerWindow.h" #include "RAMLinkMsgReader.h" +#include "Screen.h" #include "ServerApp.h" #include "ServerBitmap.h" #include "ServerConfig.h" #include "ServerCursor.h" #include "ServerPicture.h" -#include "ServerScreen.h" #include "ServerTokenSpace.h" #include "ServerWindow.h" #include "SystemPalette.h" -#include "WindowLayer.h" +#include "Window.h" #include #include @@ -444,7 +444,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link) for (int32 i = fWindowList.CountItems(); i-- > 0;) { ServerWindow* serverWindow = fWindowList.ItemAt(i); - WindowLayer* window = serverWindow->Window(); + Window* window = serverWindow->Window(); if (window == NULL || window->IsOffscreenWindow()) continue; @@ -2666,7 +2666,7 @@ ServerApp::InWorkspace(int32 index) const for (int32 i = fWindowList.CountItems(); i-- > 0;) { ServerWindow* serverWindow = fWindowList.ItemAt(i); - const WindowLayer* window = serverWindow->Window(); + const Window* window = serverWindow->Window(); if (window == NULL || window->IsOffscreenWindow()) continue; @@ -2693,7 +2693,7 @@ ServerApp::Workspaces() const for (int32 i = fWindowList.CountItems(); i-- > 0;) { ServerWindow* serverWindow = fWindowList.ItemAt(i); - const WindowLayer* window = serverWindow->Window(); + const Window* window = serverWindow->Window(); if (window == NULL || window->IsOffscreenWindow()) continue; diff --git a/src/servers/app/ServerPicture.cpp b/src/servers/app/ServerPicture.cpp index cc0bb791d5..2ec9c0f86b 100644 --- a/src/servers/app/ServerPicture.cpp +++ b/src/servers/app/ServerPicture.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007, Haiku. + * Copyright 2001-2008, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -15,8 +15,8 @@ #include "ServerFont.h" #include "ServerPicture.h" #include "ServerTokenSpace.h" -#include "ViewLayer.h" -#include "WindowLayer.h" +#include "View.h" +#include "Window.h" #include #include @@ -47,7 +47,7 @@ class ShapePainter : public BShapeIterator { virtual status_t IterateBezierTo(int32 bezierCount, BPoint *bezierPts); virtual status_t IterateClose(); - void Draw(ViewLayer *view, BRect frame, bool filled); + void Draw(View *view, BRect frame, bool filled); private: stack fOpStack; @@ -109,7 +109,7 @@ ShapePainter::IterateClose(void) } void -ShapePainter::Draw(ViewLayer *view, BRect frame, bool filled) +ShapePainter::Draw(View *view, BRect frame, bool filled) { // We're going to draw the currently iterated shape. int32 opCount, ptCount; @@ -177,14 +177,14 @@ nop() static void -move_pen_by(ViewLayer *view, BPoint delta) +move_pen_by(View *view, BPoint delta) { view->CurrentState()->SetPenLocation(view->CurrentState()->PenLocation() + delta); } static void -stroke_line(ViewLayer *view, BPoint start, BPoint end) +stroke_line(View *view, BPoint start, BPoint end) { BPoint penPos = end; @@ -200,7 +200,7 @@ stroke_line(ViewLayer *view, BPoint start, BPoint end) static void -stroke_rect(ViewLayer *view, BRect rect) +stroke_rect(View *view, BRect rect) { view->ConvertToScreenForDrawing(&rect); view->Window()->GetDrawingEngine()->StrokeRect(rect); @@ -208,7 +208,7 @@ stroke_rect(ViewLayer *view, BRect rect) static void -fill_rect(ViewLayer *view, BRect rect) +fill_rect(View *view, BRect rect) { view->ConvertToScreenForDrawing(&rect); view->Window()->GetDrawingEngine()->FillRect(rect); @@ -216,7 +216,7 @@ fill_rect(ViewLayer *view, BRect rect) static void -stroke_round_rect(ViewLayer *view, BRect rect, BPoint radii) +stroke_round_rect(View *view, BRect rect, BPoint radii) { view->ConvertToScreenForDrawing(&rect); view->Window()->GetDrawingEngine()->DrawRoundRect(rect, radii.x, radii.y, @@ -225,7 +225,7 @@ stroke_round_rect(ViewLayer *view, BRect rect, BPoint radii) static void -fill_round_rect(ViewLayer *view, BRect rect, BPoint radii) +fill_round_rect(View *view, BRect rect, BPoint radii) { view->ConvertToScreenForDrawing(&rect); view->Window()->GetDrawingEngine()->DrawRoundRect(rect, radii.x, radii.y, @@ -234,7 +234,7 @@ fill_round_rect(ViewLayer *view, BRect rect, BPoint radii) static void -stroke_bezier(ViewLayer *view, const BPoint *viewPoints) +stroke_bezier(View *view, const BPoint *viewPoints) { BPoint points[4]; view->ConvertToScreenForDrawing(points, viewPoints, 4); @@ -244,7 +244,7 @@ stroke_bezier(ViewLayer *view, const BPoint *viewPoints) static void -fill_bezier(ViewLayer *view, const BPoint *viewPoints) +fill_bezier(View *view, const BPoint *viewPoints) { BPoint points[4]; view->ConvertToScreenForDrawing(points, viewPoints, 4); @@ -254,8 +254,8 @@ fill_bezier(ViewLayer *view, const BPoint *viewPoints) static void -stroke_arc(ViewLayer *view, BPoint center, BPoint radii, float startTheta, - float arcTheta) +stroke_arc(View *view, BPoint center, BPoint radii, float startTheta, + float arcTheta) { BRect rect(center.x - radii.x, center.y - radii.y, center.x + radii.x - 1, center.y + radii.y - 1); @@ -265,8 +265,8 @@ stroke_arc(ViewLayer *view, BPoint center, BPoint radii, float startTheta, static void -fill_arc(ViewLayer *view, BPoint center, BPoint radii, float startTheta, - float arcTheta) +fill_arc(View *view, BPoint center, BPoint radii, float startTheta, + float arcTheta) { BRect rect(center.x - radii.x, center.y - radii.y, center.x + radii.x - 1, center.y + radii.y - 1); @@ -276,7 +276,7 @@ fill_arc(ViewLayer *view, BPoint center, BPoint radii, float startTheta, static void -stroke_ellipse(ViewLayer *view, BPoint center, BPoint radii) +stroke_ellipse(View *view, BPoint center, BPoint radii) { BRect rect(center.x - radii.x, center.y - radii.y, center.x + radii.x - 1, center.y + radii.y - 1); @@ -286,7 +286,7 @@ stroke_ellipse(ViewLayer *view, BPoint center, BPoint radii) static void -fill_ellipse(ViewLayer *view, BPoint center, BPoint radii) +fill_ellipse(View *view, BPoint center, BPoint radii) { BRect rect(center.x - radii.x, center.y - radii.y, center.x + radii.x - 1, center.y + radii.y - 1); @@ -296,11 +296,13 @@ fill_ellipse(ViewLayer *view, BPoint center, BPoint radii) static void -stroke_polygon(ViewLayer *view, int32 numPoints, const BPoint *viewPoints, bool isClosed) +stroke_polygon(View *view, int32 numPoints, const BPoint *viewPoints, + bool isClosed) { - if (numPoints <= 0) { + if (numPoints <= 0) return; - } else if (numPoints <= 200) { + + if (numPoints <= 200) { // fast path: no malloc/free, also avoid constructor/destructor calls char data[200 * sizeof(BPoint)]; BPoint *points = (BPoint *)data; @@ -331,11 +333,12 @@ stroke_polygon(ViewLayer *view, int32 numPoints, const BPoint *viewPoints, bool static void -fill_polygon(ViewLayer *view, int32 numPoints, const BPoint *viewPoints) +fill_polygon(View *view, int32 numPoints, const BPoint *viewPoints) { - if (numPoints <= 0) { + if (numPoints <= 0) return; - } else if (numPoints <= 200) { + + if (numPoints <= 200) { // fast path: no malloc/free, also avoid constructor/destructor calls char data[200 * sizeof(BPoint)]; BPoint *points = (BPoint *)data; @@ -366,7 +369,7 @@ fill_polygon(ViewLayer *view, int32 numPoints, const BPoint *viewPoints) static void -stroke_shape(ViewLayer *view, const BShape *shape) +stroke_shape(View *view, const BShape *shape) { ShapePainter drawShape; @@ -376,7 +379,7 @@ stroke_shape(ViewLayer *view, const BShape *shape) static void -fill_shape(ViewLayer *view, const BShape *shape) +fill_shape(View *view, const BShape *shape) { ShapePainter drawShape; @@ -386,7 +389,7 @@ fill_shape(ViewLayer *view, const BShape *shape) static void -draw_string(ViewLayer *view, const char *string, float deltaSpace, +draw_string(View *view, const char *string, float deltaSpace, float deltaNonSpace) { // NOTE: the picture data was recorded with a "set pen location" command @@ -407,10 +410,11 @@ draw_string(ViewLayer *view, const char *string, float deltaSpace, static void -draw_pixels(ViewLayer *view, BRect src, BRect dest, int32 width, int32 height, - int32 bytesPerRow, int32 pixelFormat, int32 flags, const void *data) +draw_pixels(View *view, BRect src, BRect dest, int32 width, int32 height, + int32 bytesPerRow, int32 pixelFormat, int32 flags, const void *data) { - UtilityBitmap bitmap(BRect(0, 0, width - 1, height - 1), (color_space)pixelFormat, flags, bytesPerRow); + UtilityBitmap bitmap(BRect(0, 0, width - 1, height - 1), + (color_space)pixelFormat, flags, bytesPerRow); if (!bitmap.IsValid()) return; @@ -424,7 +428,7 @@ draw_pixels(ViewLayer *view, BRect src, BRect dest, int32 width, int32 height, static void -draw_picture(ViewLayer *view, BPoint where, int32 token) +draw_picture(View *view, BPoint where, int32 token) { ServerPicture *picture = view->Window()->ServerWindow()->App()->FindPicture(token); if (picture != NULL) { @@ -435,7 +439,7 @@ draw_picture(ViewLayer *view, BPoint where, int32 token) static void -set_clipping_rects(ViewLayer *view, const BRect *rects, uint32 numRects) +set_clipping_rects(View *view, const BRect *rects, uint32 numRects) { // TODO: This might be too slow, we should copy the rects // directly to BRegion's internal data @@ -447,8 +451,8 @@ set_clipping_rects(ViewLayer *view, const BRect *rects, uint32 numRects) static void -clip_to_picture(ViewLayer *view, BPicture *picture, BPoint pt, - bool clip_to_inverse_picture) +clip_to_picture(View *view, BPicture *picture, BPoint pt, + bool clip_to_inverse_picture) { printf("ClipToPicture(picture, BPoint(%.2f, %.2f), %s)\n", pt.x, pt.y, clip_to_inverse_picture ? "inverse" : ""); @@ -456,14 +460,14 @@ clip_to_picture(ViewLayer *view, BPicture *picture, BPoint pt, static void -push_state(ViewLayer *view) +push_state(View *view) { view->PushState(); } static void -pop_state(ViewLayer *view) +pop_state(View *view) { view->PopState(); @@ -477,40 +481,40 @@ pop_state(ViewLayer *view) // TODO: Be smart and actually take advantage of these methods: // only apply state changes when they are called static void -enter_state_change(ViewLayer *view) +enter_state_change(View *view) { } static void -exit_state_change(ViewLayer *view) +exit_state_change(View *view) { view->Window()->ServerWindow()->ResyncDrawState(); } static void -enter_font_state(ViewLayer *view) +enter_font_state(View *view) { } static void -exit_font_state(ViewLayer *view) +exit_font_state(View *view) { view->Window()->GetDrawingEngine()->SetFont(view->CurrentState()->Font()); } static void -set_origin(ViewLayer *view, BPoint pt) +set_origin(View *view, BPoint pt) { view->CurrentState()->SetOrigin(pt); } static void -set_pen_location(ViewLayer *view, BPoint pt) +set_pen_location(View *view, BPoint pt) { view->CurrentState()->SetPenLocation(pt); // the DrawingEngine/Painter does not need to be updated, since this @@ -520,7 +524,7 @@ set_pen_location(ViewLayer *view, BPoint pt) static void -set_drawing_mode(ViewLayer *view, drawing_mode mode) +set_drawing_mode(View *view, drawing_mode mode) { view->CurrentState()->SetDrawingMode(mode); view->Window()->GetDrawingEngine()->SetDrawingMode(mode); @@ -528,7 +532,7 @@ set_drawing_mode(ViewLayer *view, drawing_mode mode) static void -set_line_mode(ViewLayer *view, cap_mode capMode, join_mode joinMode, float miterLimit) +set_line_mode(View *view, cap_mode capMode, join_mode joinMode, float miterLimit) { DrawState *state = view->CurrentState(); state->SetLineCapMode(capMode); @@ -539,7 +543,7 @@ set_line_mode(ViewLayer *view, cap_mode capMode, join_mode joinMode, float miter static void -set_pen_size(ViewLayer *view, float size) +set_pen_size(View *view, float size) { view->CurrentState()->SetPenSize(size); view->Window()->GetDrawingEngine()->SetPenSize(view->CurrentState()->PenSize()); @@ -549,7 +553,7 @@ set_pen_size(ViewLayer *view, float size) static void -set_fore_color(ViewLayer *view, rgb_color color) +set_fore_color(View *view, rgb_color color) { view->CurrentState()->SetHighColor(color); view->Window()->GetDrawingEngine()->SetHighColor(color); @@ -557,7 +561,7 @@ set_fore_color(ViewLayer *view, rgb_color color) static void -set_back_color(ViewLayer *view, rgb_color color) +set_back_color(View *view, rgb_color color) { view->CurrentState()->SetLowColor(color); view->Window()->GetDrawingEngine()->SetLowColor(color); @@ -565,7 +569,7 @@ set_back_color(ViewLayer *view, rgb_color color) static void -set_stipple_pattern(ViewLayer *view, pattern p) +set_stipple_pattern(View *view, pattern p) { view->CurrentState()->SetPattern(Pattern(p)); view->Window()->GetDrawingEngine()->SetPattern(p); @@ -573,7 +577,7 @@ set_stipple_pattern(ViewLayer *view, pattern p) static void -set_scale(ViewLayer *view, float scale) +set_scale(View *view, float scale) { view->CurrentState()->SetScale(scale); view->Window()->ServerWindow()->ResyncDrawState(); @@ -584,7 +588,7 @@ set_scale(ViewLayer *view, float scale) static void -set_font_family(ViewLayer *view, const char *family) +set_font_family(View *view, const char *family) { // TODO: Implement // Can we have a ServerFont::SetFamily() which accepts a string ? @@ -592,7 +596,7 @@ set_font_family(ViewLayer *view, const char *family) static void -set_font_style(ViewLayer *view, const char *style) +set_font_style(View *view, const char *style) { // TODO: Implement // Can we have a ServerFont::SetStyle() which accepts a string ? @@ -600,7 +604,7 @@ set_font_style(ViewLayer *view, const char *style) static void -set_font_spacing(ViewLayer *view, int32 spacing) +set_font_spacing(View *view, int32 spacing) { ServerFont font; font.SetSpacing(spacing); @@ -609,7 +613,7 @@ set_font_spacing(ViewLayer *view, int32 spacing) static void -set_font_size(ViewLayer *view, float size) +set_font_size(View *view, float size) { ServerFont font; font.SetSize(size); @@ -618,7 +622,7 @@ set_font_size(ViewLayer *view, float size) static void -set_font_rotate(ViewLayer *view, float rotation) +set_font_rotate(View *view, float rotation) { ServerFont font; font.SetRotation(rotation); @@ -627,7 +631,7 @@ set_font_rotate(ViewLayer *view, float rotation) static void -set_font_encoding(ViewLayer *view, int32 encoding) +set_font_encoding(View *view, int32 encoding) { ServerFont font; font.SetEncoding(encoding); @@ -636,7 +640,7 @@ set_font_encoding(ViewLayer *view, int32 encoding) static void -set_font_flags(ViewLayer *view, int32 flags) +set_font_flags(View *view, int32 flags) { ServerFont font; font.SetFlags(flags); @@ -645,7 +649,7 @@ set_font_flags(ViewLayer *view, int32 flags) static void -set_font_shear(ViewLayer *view, float shear) +set_font_shear(View *view, float shear) { ServerFont font; font.SetShear(shear); @@ -654,7 +658,7 @@ set_font_shear(ViewLayer *view, float shear) static void -set_font_face(ViewLayer *view, int32 face) +set_font_face(View *view, int32 face) { ServerFont font; font.SetFace(face); @@ -663,7 +667,7 @@ set_font_face(ViewLayer *view, int32 face) static void -set_blending_mode(ViewLayer *view, int16 alphaSrcMode, int16 alphaFncMode) +set_blending_mode(View *view, int16 alphaSrcMode, int16 alphaFncMode) { view->CurrentState()->SetBlendingMode((source_alpha)alphaSrcMode, (alpha_function)alphaFncMode); } @@ -813,7 +817,7 @@ ServerPicture::ExitStateChange() void -ServerPicture::SyncState(ViewLayer *view) +ServerPicture::SyncState(View *view) { // TODO: Finish this EnterStateChange(); @@ -903,7 +907,7 @@ ServerPicture::SetFontFromLink(BPrivate::LinkReceiver& link) void -ServerPicture::Play(ViewLayer *view) +ServerPicture::Play(View *view) { // TODO: for now: then change PicturePlayer to accept a BPositionIO object BMallocIO *mallocIO = dynamic_cast(fData); diff --git a/src/servers/app/ServerPicture.h b/src/servers/app/ServerPicture.h index 3c84244157..4f5869645a 100644 --- a/src/servers/app/ServerPicture.h +++ b/src/servers/app/ServerPicture.h @@ -1,18 +1,27 @@ -#ifndef __SERVER_PICTURE_H -#define __SERVER_PICTURE_H +/* + * Copyright 2001-2008, Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * DarkWyrm + * Stefano Ceccherini + */ +#ifndef SERVER_PICTURE_H +#define SERVER_PICTURE_H #include #include -#include - // TODO: For some reason, the forward declaration "class BPrivate::PortLink" causes compiling errors - class ServerApp; -class ViewLayer; -class BPrivate::LinkReceiver; +class View; +namespace BPrivate { + class LinkReceiver; + class PortLink; +} class BList; + class ServerPicture : public PictureDataWriter { public: int32 Token() { return fToken; } @@ -20,10 +29,10 @@ public: void EnterStateChange(); void ExitStateChange(); - void SyncState(ViewLayer *view); + void SyncState(View *view); void SetFontFromLink(BPrivate::LinkReceiver& link); - void Play(ViewLayer *view); + void Play(View *view); void Usurp(ServerPicture *newPicture); ServerPicture* StepDown(); @@ -50,4 +59,4 @@ friend class ServerApp; ServerPicture *fUsurped; }; -#endif // __SERVER_PICTURE_H +#endif // SERVER_PICTURE_H diff --git a/src/servers/app/ServerWindow.cpp b/src/servers/app/ServerWindow.cpp index a09720d248..450c1ce7af 100644 --- a/src/servers/app/ServerWindow.cpp +++ b/src/servers/app/ServerWindow.cpp @@ -16,7 +16,7 @@ A ServerWindow handles all the intraserver tasks required of it by its BWindow. There are too many tasks to list as being done by them, but they include handling View transactions, - coordinating and linking a window's WindowLayer half with its messaging half, dispatching + coordinating and linking a window's Window half with its messaging half, dispatching mouse and key events from the server to its window, and other such things. */ @@ -36,8 +36,8 @@ #include "ServerBitmap.h" #include "ServerPicture.h" #include "ServerProtocol.h" -#include "WindowLayer.h" -#include "WorkspacesLayer.h" +#include "Window.h" +#include "WorkspacesView.h" #include "clipping.h" @@ -154,7 +154,7 @@ ServerWindow::ServerWindow(const char *title, ServerApp *app, fTitle(NULL), fDesktop(app->GetDesktop()), fServerApp(app), - fWindowLayer(NULL), + fWindow(NULL), fWindowAddedToDesktop(false), fClientTeam(app->ClientTeam()), @@ -165,7 +165,7 @@ ServerWindow::ServerWindow(const char *title, ServerApp *app, fClientToken(clientToken), - fCurrentLayer(NULL), + fCurrentView(NULL), fCurrentDrawingRegion(), fCurrentDrawingRegionValid(false), @@ -206,15 +206,15 @@ ServerWindow::~ServerWindow() { STRACE(("ServerWindow(%s@%p):~ServerWindow()\n", fTitle, this)); - if (!fWindowLayer->IsOffscreenWindow()) { + if (!fWindow->IsOffscreenWindow()) { fWindowAddedToDesktop = false; - fDesktop->RemoveWindow(fWindowLayer); + fDesktop->RemoveWindow(fWindow); } if (App() != NULL) App()->RemoveWindow(this); - delete fWindowLayer; + delete fWindow; free(fTitle); delete_port(fMessagePort); @@ -280,14 +280,14 @@ ServerWindow::Init(BRect frame, window_look look, window_feel feel, fLink.SetSenderPort(fClientReplyPort); fLink.SetReceiverPort(fMessagePort); - // We cannot call MakeWindowLayer in the constructor, since it + // We cannot call MakeWindow in the constructor, since it // is a virtual function! - fWindowLayer = MakeWindowLayer(frame, fTitle, look, feel, flags, workspace); - if (!fWindowLayer) + fWindow = MakeWindow(frame, fTitle, look, feel, flags, workspace); + if (!fWindow) return B_NO_MEMORY; - if (!fWindowLayer->IsOffscreenWindow()) { - fDesktop->AddWindow(fWindowLayer); + if (!fWindow->IsOffscreenWindow()) { + fDesktop->AddWindow(fWindow); fWindowAddedToDesktop = true; } @@ -308,9 +308,9 @@ ServerWindow::Run() fLink.Attach(fMessagePort); int32 minWidth, maxWidth, minHeight, maxHeight; - fWindowLayer->GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight); + fWindow->GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight); - fLink.Attach(fWindowLayer->Frame()); + fLink.Attach(fWindow->Frame()); fLink.Attach((float)minWidth); fLink.Attach((float)maxWidth); fLink.Attach((float)minHeight); @@ -353,24 +353,24 @@ ServerWindow::ReplaceDecorator() debugger("you must lock a ServerWindow object before calling ::ReplaceDecorator()\n"); STRACE(("ServerWindow %s: Replace Decorator\n", fTitle)); - //fWindowLayer->UpdateDecorator(); + //fWindow->UpdateDecorator(); } -//! Shows the window's WindowLayer +//! Shows the window's Window void ServerWindow::_Show() { // NOTE: if you do something else, other than sending a port message, PLEASE lock STRACE(("ServerWindow %s: _Show\n", Title())); - if (fQuitting || !fWindowLayer->IsHidden() || fWindowLayer->IsOffscreenWindow()) + if (fQuitting || !fWindow->IsHidden() || fWindow->IsOffscreenWindow()) return; // TODO: Maybe we need to dispatch a message to the desktop to show/hide us // instead of doing it from this thread. fDesktop->UnlockSingleWindow(); - fDesktop->ShowWindow(fWindowLayer); + fDesktop->ShowWindow(fWindow); fDesktop->LockSingleWindow(); if (fDirectWindowData != NULL) @@ -378,21 +378,21 @@ ServerWindow::_Show() } -//! Hides the window's WindowLayer +//! Hides the window's Window void ServerWindow::_Hide() { // NOTE: if you do something else, other than sending a port message, PLEASE lock STRACE(("ServerWindow %s: _Hide\n", Title())); - if (fWindowLayer->IsHidden() || fWindowLayer->IsOffscreenWindow()) + if (fWindow->IsHidden() || fWindow->IsOffscreenWindow()) return; if (fDirectWindowData != NULL) HandleDirectConnection(B_DIRECT_STOP); fDesktop->UnlockSingleWindow(); - fDesktop->HideWindow(fWindowLayer); + fDesktop->HideWindow(fWindow); fDesktop->LockSingleWindow(); } @@ -432,9 +432,9 @@ ServerWindow::SetTitle(const char* newTitle) rename_thread(Thread(), name); } - if (fWindowLayer != NULL) { + if (fWindow != NULL) { //fDesktop->UnlockSingleWindow(); - fDesktop->SetWindowTitle(fWindowLayer, newTitle); + fDesktop->SetWindowTitle(fWindow, newTitle); //fDesktop->LockSingleWindow(); } } @@ -456,7 +456,7 @@ ServerWindow::NotifyQuitRequested() void ServerWindow::NotifyMinimize(bool minimize) { - if (fWindowLayer->Feel() != B_NORMAL_WINDOW_FEEL) + if (fWindow->Feel() != B_NORMAL_WINDOW_FEEL) return; // The client is responsible for the actual minimization @@ -489,47 +489,47 @@ ServerWindow::GetInfo(window_info& info) info.thread = Thread(); info.client_token = ClientToken(); info.client_port = fClientLooperPort; - info.workspaces = fWindowLayer->Workspaces(); + info.workspaces = fWindow->Workspaces(); info.layer = 0; // ToDo: what is this??? - info.feel = fWindowLayer->Feel(); - info.flags = fWindowLayer->Flags(); - info.window_left = (int)floor(fWindowLayer->Frame().left); - info.window_top = (int)floor(fWindowLayer->Frame().top); - info.window_right = (int)floor(fWindowLayer->Frame().right); - info.window_bottom = (int)floor(fWindowLayer->Frame().bottom); + info.feel = fWindow->Feel(); + info.flags = fWindow->Flags(); + info.window_left = (int)floor(fWindow->Frame().left); + info.window_top = (int)floor(fWindow->Frame().top); + info.window_right = (int)floor(fWindow->Frame().right); + info.window_bottom = (int)floor(fWindow->Frame().bottom); - info.show_hide_level = fWindowLayer->IsHidden() ? 1 : 0; // ??? - info.is_mini = fWindowLayer->IsMinimized(); + info.show_hide_level = fWindow->IsHidden() ? 1 : 0; // ??? + info.is_mini = fWindow->IsMinimized(); } void ServerWindow::ResyncDrawState() { - _UpdateDrawState(fCurrentLayer); + _UpdateDrawState(fCurrentView); } /*! - Returns the ServerWindow's WindowLayer, if it exists and has been + Returns the ServerWindow's Window, if it exists and has been added to the Desktop already. In other words, you cannot assume this method will always give you a valid pointer. */ -WindowLayer* +Window* ServerWindow::Window() const { // TODO: ensure desktop is locked! if (!fWindowAddedToDesktop) return NULL; - return fWindowLayer; + return fWindow; } -ViewLayer* -ServerWindow::_CreateLayerTree(BPrivate::LinkReceiver &link, ViewLayer **_parent) +View* +ServerWindow::_CreateView(BPrivate::LinkReceiver &link, View **_parent) { // NOTE: no need to check for a lock. This is a private method. @@ -557,16 +557,16 @@ ServerWindow::_CreateLayerTree(BPrivate::LinkReceiver &link, ViewLayer **_parent link.Read(&viewColor); link.Read(&parentToken); - STRACE(("ServerWindow(%s)::_CreateLayerTree()-> layer %s, token %ld\n", + STRACE(("ServerWindow(%s)::_CreateView()-> layer %s, token %ld\n", fTitle, name, token)); - ViewLayer* newLayer; + View* newLayer; if ((flags & kWorkspacesViewFlag) != 0) { - newLayer = new (nothrow) WorkspacesLayer(frame, scrollingOffset, name, + newLayer = new (nothrow) WorkspacesView(frame, scrollingOffset, name, token, resizeMask, flags); } else { - newLayer = new (nothrow) ViewLayer(frame, scrollingOffset, name, token, + newLayer = new (nothrow) View(frame, scrollingOffset, name, token, resizeMask, flags); } @@ -599,7 +599,7 @@ fDesktop->LockAllWindows(); newLayer->CurrentState()->SetFont(font); if (_parent) { - ViewLayer *parent; + View *parent; if (App()->ViewTokens().GetToken(parentToken, B_HANDLER_TOKEN, (void**)&parent) != B_OK || parent->Window()->ServerWindow() != this) { @@ -616,7 +616,7 @@ fDesktop->LockAllWindows(); /*! Dispatches all window messages, and those view messages that - don't need a valid fCurrentLayer (ie. layer creation). + don't need a valid fCurrentView (ie. layer creation). */ void ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) @@ -645,28 +645,28 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) break; } - if (minimize && !fWindowLayer->IsHidden()) + if (minimize && !fWindow->IsHidden()) _Hide(); - else if (!minimize && fWindowLayer->IsHidden()) + else if (!minimize && fWindow->IsHidden()) _Show(); - fWindowLayer->SetMinimized(minimize); + fWindow->SetMinimized(minimize); } break; } case AS_ACTIVATE_WINDOW: { - DTRACE(("ServerWindow %s: Message AS_ACTIVATE_WINDOW: ViewLayer: %s\n", Title(), fCurrentLayer->Name())); + DTRACE(("ServerWindow %s: Message AS_ACTIVATE_WINDOW: View: %s\n", Title(), fCurrentView->Name())); bool activate = true; link.Read(&activate); //fDesktop->UnlockSingleWindow(); if (activate) - fDesktop->ActivateWindow(fWindowLayer); + fDesktop->ActivateWindow(fWindow); else - fDesktop->SendWindowBehind(fWindowLayer, NULL); + fDesktop->SendWindowBehind(fWindow, NULL); //fDesktop->LockSingleWindow(); break; } @@ -680,11 +680,12 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) link.Read(&token); link.Read(&teamID); - WindowLayer *behindOf; - if ((behindOf = fDesktop->FindWindowLayerByClientToken(token, teamID)) != NULL) { + ::Window *behindOf = fDesktop->FindWindowByClientToken(token, + teamID); + if (behindOf != NULL) { //fDesktop->UnlockSingleWindow(); // TODO: there is a big race condition when we unlock here (window could be gone by now)! - fDesktop->SendWindowBehind(fWindowLayer, behindOf); + fDesktop->SendWindowBehind(fWindow, behindOf); //fDesktop->LockSingleWindow(); status = B_OK; } else @@ -704,20 +705,20 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) { STRACE(("ServerWindow %s: Message AS_ENABLE_UPDATES unimplemented\n", Title())); - fWindowLayer->EnableUpdateRequests(); + fWindow->EnableUpdateRequests(); break; } case AS_DISABLE_UPDATES: { STRACE(("ServerWindow %s: Message AS_DISABLE_UPDATES unimplemented\n", Title())); - fWindowLayer->DisableUpdateRequests(); + fWindow->DisableUpdateRequests(); break; } case AS_NEEDS_UPDATE: { STRACE(("ServerWindow %s: Message AS_NEEDS_UPDATE\n", Title())); - if (fWindowLayer->NeedsUpdate()) + if (fWindow->NeedsUpdate()) fLink.StartMessage(B_OK); else fLink.StartMessage(B_ERROR); @@ -741,15 +742,14 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) int32 token; if (link.Read(&token) == B_OK) { - WindowLayer* windowLayer = fDesktop->FindWindowLayerByClientToken( - token, App()->ClientTeam()); - if (windowLayer == NULL - || windowLayer->Feel() != B_NORMAL_WINDOW_FEEL) { + ::Window* window = fDesktop->FindWindowByClientToken(token, + App()->ClientTeam()); + if (window == NULL || window->Feel() != B_NORMAL_WINDOW_FEEL) { status = B_BAD_VALUE; } else { //fDesktop->UnlockSingleWindow(); // TODO: there is a big race condition when we unlock here (window could be gone by now)! - status = fDesktop->AddWindowToSubset(fWindowLayer, windowLayer) + status = fDesktop->AddWindowToSubset(fWindow, window) ? B_OK : B_NO_MEMORY; //fDesktop->LockSingleWindow(); } @@ -766,12 +766,12 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) int32 token; if (link.Read(&token) == B_OK) { - WindowLayer* windowLayer = fDesktop->FindWindowLayerByClientToken( - token, App()->ClientTeam()); - if (windowLayer != NULL) { + ::Window* window = fDesktop->FindWindowByClientToken(token, + App()->ClientTeam()); + if (window != NULL) { //fDesktop->UnlockSingleWindow(); // TODO: there is a big race condition when we unlock here (window could be gone by now)! - fDesktop->RemoveWindowFromSubset(fWindowLayer, windowLayer); + fDesktop->RemoveWindowFromSubset(fWindow, window); //fDesktop->LockSingleWindow(); status = B_OK; } else @@ -791,13 +791,13 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) int32 look; if (link.Read(&look) == B_OK) { // test if look is valid - status = WindowLayer::IsValidLook((window_look)look) + status = Window::IsValidLook((window_look)look) ? B_OK : B_BAD_VALUE; } - if (status == B_OK && !fWindowLayer->IsOffscreenWindow()) { + if (status == B_OK && !fWindow->IsOffscreenWindow()) { //fDesktop->UnlockSingleWindow(); - fDesktop->SetWindowLook(fWindowLayer, (window_look)look); + fDesktop->SetWindowLook(fWindow, (window_look)look); //fDesktop->LockSingleWindow(); } @@ -813,13 +813,13 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) int32 feel; if (link.Read(&feel) == B_OK) { // test if feel is valid - status = WindowLayer::IsValidFeel((window_feel)feel) + status = Window::IsValidFeel((window_feel)feel) ? B_OK : B_BAD_VALUE; } - if (status == B_OK && !fWindowLayer->IsOffscreenWindow()) { + if (status == B_OK && !fWindow->IsOffscreenWindow()) { //fDesktop->UnlockSingleWindow(); - fDesktop->SetWindowFeel(fWindowLayer, (window_feel)feel); + fDesktop->SetWindowFeel(fWindow, (window_feel)feel); //fDesktop->LockSingleWindow(); } @@ -835,13 +835,13 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) uint32 flags; if (link.Read(&flags) == B_OK) { // test if flags are valid - status = (flags & ~WindowLayer::ValidWindowFlags()) == 0 + status = (flags & ~Window::ValidWindowFlags()) == 0 ? B_OK : B_BAD_VALUE; } - if (status == B_OK && !fWindowLayer->IsOffscreenWindow()) { + if (status == B_OK && !fWindow->IsOffscreenWindow()) { //fDesktop->UnlockSingleWindow(); - fDesktop->SetWindowFlags(fWindowLayer, flags); + fDesktop->SetWindowFlags(fWindow, flags); //fDesktop->LockSingleWindow(); } @@ -864,7 +864,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) } #endif case AS_IS_FRONT_WINDOW: - fLink.StartMessage(fDesktop->FrontWindow() == fWindowLayer ? B_OK : B_ERROR); + fLink.StartMessage(fDesktop->FrontWindow() == fWindow ? B_OK : B_ERROR); fLink.Flush(); break; @@ -872,7 +872,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) { STRACE(("ServerWindow %s: Message AS_GET_WORKSPACES\n", Title())); fLink.StartMessage(B_OK); - fLink.Attach(fWindowLayer->Workspaces()); + fLink.Attach(fWindow->Workspaces()); fLink.Flush(); break; } @@ -886,7 +886,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) Title(), newWorkspaces)); //fDesktop->UnlockSingleWindow(); - fDesktop->SetWindowWorkspaces(fWindowLayer, newWorkspaces); + fDesktop->SetWindowWorkspaces(fWindow, newWorkspaces); //fDesktop->LockSingleWindow(); break; } @@ -901,13 +901,13 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) STRACE(("ServerWindow %s: Message AS_WINDOW_RESIZE %.1f, %.1f\n", Title(), xResizeBy, yResizeBy)); - if (fWindowLayer->IsResizing()) { + if (fWindow->IsResizing()) { // While the user resizes the window, we ignore // pragmatically set window bounds fLink.StartMessage(B_BUSY); } else { //fDesktop->UnlockSingleWindow(); - fDesktop->ResizeWindowBy(fWindowLayer, xResizeBy, yResizeBy); + fDesktop->ResizeWindowBy(fWindow, xResizeBy, yResizeBy); //fDesktop->LockSingleWindow(); fLink.StartMessage(B_OK); } @@ -925,13 +925,13 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) STRACE(("ServerWindow %s: Message AS_WINDOW_MOVE: %.1f, %.1f\n", Title(), xMoveBy, yMoveBy)); - if (fWindowLayer->IsDragging()) { + if (fWindow->IsDragging()) { // While the user moves the window, we ignore // pragmatically set window positions fLink.StartMessage(B_BUSY); } else { //fDesktop->UnlockSingleWindow(); - fDesktop->MoveWindowBy(fWindowLayer, xMoveBy, yMoveBy); + fDesktop->MoveWindowBy(fWindow, xMoveBy, yMoveBy); //fDesktop->LockSingleWindow(); fLink.StartMessage(B_OK); } @@ -962,7 +962,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) //fDesktop->UnlockSingleWindow(); if (fDesktop->LockAllWindows()) { - fWindowLayer->SetSizeLimits(minWidth, maxWidth, + fWindow->SetSizeLimits(minWidth, maxWidth, minHeight, maxHeight); fDesktop->UnlockAllWindows(); } @@ -970,11 +970,11 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) //fDesktop->LockSingleWindow(); // and now, sync the client to the limits that we were able to enforce - fWindowLayer->GetSizeLimits(&minWidth, &maxWidth, + fWindow->GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight); fLink.StartMessage(B_OK); - fLink.Attach(fWindowLayer->Frame()); + fLink.Attach(fWindow->Frame()); fLink.Attach((float)minWidth); fLink.Attach((float)maxWidth); fLink.Attach((float)minHeight); @@ -989,13 +989,13 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) STRACE(("ServerWindow %s: Message AS_SET_DECORATOR_SETTINGS\n")); int32 size; - if (fWindowLayer && link.Read(&size) == B_OK) { + if (fWindow && link.Read(&size) == B_OK) { char buffer[size]; if (link.Read(buffer, size) == B_OK) { BMessage settings; if (settings.Unflatten(buffer) == B_OK) { //fDesktop->UnlockSingleWindow(); - fDesktop->SetWindowDecoratorSettings(fWindowLayer, settings); + fDesktop->SetWindowDecoratorSettings(fWindow, settings); //fDesktop->LockSingleWindow(); } } @@ -1010,7 +1010,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) bool success = false; BMessage settings; - if (fWindowLayer->GetDecoratorSettings(&settings)) { + if (fWindow->GetDecoratorSettings(&settings)) { int32 size = settings.FlattenedSize(); char buffer[size]; if (settings.Flatten(buffer, size) == B_OK) { @@ -1045,12 +1045,12 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) case AS_BEGIN_UPDATE: DTRACE(("ServerWindowo %s: AS_BEGIN_UPDATE\n", Title())); - fWindowLayer->BeginUpdate(fLink); + fWindow->BeginUpdate(fLink); break; case AS_END_UPDATE: DTRACE(("ServerWindowo %s: AS_END_UPDATE\n", Title())); - fWindowLayer->EndUpdate(); + fWindow->EndUpdate(); break; case AS_GET_MOUSE: @@ -1101,9 +1101,9 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) link.Read(&enable); status_t status = B_OK; - if (!fWindowLayer->IsOffscreenWindow()) { + if (!fWindow->IsOffscreenWindow()) { //fDesktop->UnlockSingleWindow(); - fDesktop->SetWindowFeel(fWindowLayer, + fDesktop->SetWindowFeel(fWindow, enable ? kWindowScreenFeel : B_NORMAL_WINDOW_FEEL); //fDesktop->LockSingleWindow(); } else @@ -1114,7 +1114,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) break; } - // View creation and destruction (don't need a valid fCurrentLayer) + // View creation and destruction (don't need a valid fCurrentView) case AS_SET_CURRENT_LAYER: { @@ -1122,7 +1122,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) if (link.Read(&token) != B_OK) break; - ViewLayer *current; + View *current; if (App()->ViewTokens().GetToken(token, B_HANDLER_TOKEN, (void**)¤t) != B_OK || current->Window()->ServerWindow() != this) { @@ -1131,7 +1131,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) current = NULL; } else { DTRACE(("ServerWindow %s: Message AS_SET_CURRENT_LAYER: %s, token %ld\n", fTitle, current->Name(), token)); - _SetCurrentLayer(current); + _SetCurrentView(current); } break; } @@ -1142,22 +1142,22 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) // Start receiving top_view data -- pass NULL as the parent view. // This should be the *only* place where this happens. - if (fCurrentLayer != NULL) { - fprintf(stderr, "ServerWindow %s: Message AS_LAYER_CREATE_ROOT: fCurrentLayer already set!!\n", fTitle); + if (fCurrentView != NULL) { + fprintf(stderr, "ServerWindow %s: Message AS_LAYER_CREATE_ROOT: fCurrentView already set!!\n", fTitle); break; } - _SetCurrentLayer(_CreateLayerTree(link, NULL)); - fWindowLayer->SetTopLayer(fCurrentLayer); + _SetCurrentView(_CreateView(link, NULL)); + fWindow->SetTopLayer(fCurrentView); break; } case AS_LAYER_CREATE: { - STRACE(("ServerWindow %s: Message AS_LAYER_CREATE: ViewLayer name: %s\n", fTitle, fCurrentLayer->Name())); + STRACE(("ServerWindow %s: Message AS_LAYER_CREATE: View name: %s\n", fTitle, fCurrentView->Name())); - ViewLayer* parent = NULL; - ViewLayer* newLayer = _CreateLayerTree(link, &parent); + View* parent = NULL; + View* newLayer = _CreateView(link, &parent); if (parent != NULL && newLayer != NULL) parent->AddChild(newLayer); else @@ -1166,10 +1166,10 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) } default: - // TODO: when creating a ViewLayer, check for yet non-existing ViewLayer::InitCheck() - // and take appropriate actions, then checking for fCurrentLayer->CurrentState() + // TODO: when creating a View, check for yet non-existing View::InitCheck() + // and take appropriate actions, then checking for fCurrentView->CurrentState() // is unnecessary - if (fCurrentLayer == NULL || fCurrentLayer->CurrentState() == NULL) { + if (fCurrentView == NULL || fCurrentView->CurrentState() == NULL) { BString codeName; string_for_message_code(code, codeName); printf("ServerWindow %s received unexpected code - " @@ -1189,7 +1189,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) /*! - Dispatches all view messages that need a valid fCurrentLayer. + Dispatches all view messages that need a valid fCurrentView. */ void ServerWindow::_DispatchViewMessage(int32 code, @@ -1201,13 +1201,13 @@ ServerWindow::_DispatchViewMessage(int32 code, switch (code) { case AS_LAYER_SCROLL: { - DTRACE(("ServerWindow %s: Message AS_LAYER_SCROLL: ViewLayer name: %s\n", fTitle, fCurrentLayer->Name())); + DTRACE(("ServerWindow %s: Message AS_LAYER_SCROLL: View name: %s\n", fTitle, fCurrentView->Name())); float dh; float dv; link.Read(&dh); link.Read(&dv); - fWindowLayer->ScrollViewBy(fCurrentLayer, dh, dv); + fWindow->ScrollViewBy(fCurrentView, dh, dv); break; } case AS_LAYER_COPY_BITS: @@ -1220,8 +1220,8 @@ ServerWindow::_DispatchViewMessage(int32 code, BRegion contentRegion; // TODO: avoid copy operation maybe? - fWindowLayer->GetContentRegion(&contentRegion); - fCurrentLayer->CopyBits(src, dst, contentRegion); + fWindow->GetContentRegion(&contentRegion); + fCurrentView->CopyBits(src, dst, contentRegion); break; } case AS_LAYER_DELETE: @@ -1232,11 +1232,11 @@ ServerWindow::_DispatchViewMessage(int32 code, if (link.Read(&token) != B_OK) break; - ViewLayer *view; + View *view; if (App()->ViewTokens().GetToken(token, B_HANDLER_TOKEN, (void**)&view) == B_OK && view->Window()->ServerWindow() == this) { - ViewLayer* parent = view->Parent(); + View* parent = view->Parent(); STRACE(("ServerWindow %s: AS_LAYER_DELETE view: %p, parent: %p\n", fTitle, view, parent)); @@ -1254,8 +1254,8 @@ fDesktop->UnlockSingleWindow(); EventTarget(), token); fDesktop->LockSingleWindow(); } - if (fCurrentLayer == view) - _SetCurrentLayer(parent); + if (fCurrentView == view) + _SetCurrentView(parent); delete view; } // else we don't delete the root view } @@ -1263,51 +1263,51 @@ fDesktop->LockSingleWindow(); } case AS_LAYER_SET_STATE: { - DTRACE(("ServerWindow %s: Message AS_LAYER_SET_STATE: ViewLayer name: %s\n", fTitle, fCurrentLayer->Name())); + DTRACE(("ServerWindow %s: Message AS_LAYER_SET_STATE: View name: %s\n", fTitle, fCurrentView->Name())); - fCurrentLayer->CurrentState()->ReadFromLink(link); + fCurrentView->CurrentState()->ReadFromLink(link); // TODO: When is this used?!? - fCurrentLayer->RebuildClipping(true); - _UpdateDrawState(fCurrentLayer); + fCurrentView->RebuildClipping(true); + _UpdateDrawState(fCurrentView); break; } case AS_LAYER_SET_FONT_STATE: { - DTRACE(("ServerWindow %s: Message AS_LAYER_SET_FONT_STATE: ViewLayer name: %s\n", fTitle, fCurrentLayer->Name())); - fCurrentLayer->CurrentState()->ReadFontFromLink(link); - fWindowLayer->GetDrawingEngine()->SetFont( - fCurrentLayer->CurrentState()); + DTRACE(("ServerWindow %s: Message AS_LAYER_SET_FONT_STATE: View name: %s\n", fTitle, fCurrentView->Name())); + fCurrentView->CurrentState()->ReadFontFromLink(link); + fWindow->GetDrawingEngine()->SetFont( + fCurrentView->CurrentState()); break; } case AS_LAYER_GET_STATE: { - DTRACE(("ServerWindow %s: Message AS_LAYER_GET_STATE: ViewLayer name: %s\n", fTitle, fCurrentLayer->Name())); + DTRACE(("ServerWindow %s: Message AS_LAYER_GET_STATE: View name: %s\n", fTitle, fCurrentView->Name())); fLink.StartMessage(B_OK); // attach state data - fCurrentLayer->CurrentState()->WriteToLink(fLink.Sender()); + fCurrentView->CurrentState()->WriteToLink(fLink.Sender()); fLink.Flush(); break; } case AS_LAYER_SET_EVENT_MASK: { - STRACE(("ServerWindow %s: Message AS_LAYER_SET_EVENT_MASK: ViewLayer name: %s\n", fTitle, fCurrentLayer->Name())); + STRACE(("ServerWindow %s: Message AS_LAYER_SET_EVENT_MASK: View name: %s\n", fTitle, fCurrentView->Name())); uint32 eventMask, options; link.Read(&eventMask); if (link.Read(&options) == B_OK) { - fCurrentLayer->SetEventMask(eventMask, options); + fCurrentView->SetEventMask(eventMask, options); fDesktop->UnlockSingleWindow(); // TODO: possible deadlock! if (eventMask != 0 || options != 0) { fDesktop->EventDispatcher().AddListener(EventTarget(), - fCurrentLayer->Token(), eventMask, options); + fCurrentView->Token(), eventMask, options); } else { fDesktop->EventDispatcher().RemoveListener(EventTarget(), - fCurrentLayer->Token()); + fCurrentView->Token()); } fDesktop->LockSingleWindow(); } @@ -1315,7 +1315,7 @@ fDesktop->LockSingleWindow(); } case AS_LAYER_SET_MOUSE_EVENT_MASK: { - STRACE(("ServerWindow %s: Message AS_LAYER_SET_MOUSE_EVENT_MASK: ViewLayer name: %s\n", fTitle, fCurrentLayer->Name())); + STRACE(("ServerWindow %s: Message AS_LAYER_SET_MOUSE_EVENT_MASK: View name: %s\n", fTitle, fCurrentView->Name())); uint32 eventMask, options; link.Read(&eventMask); @@ -1324,10 +1324,10 @@ fDesktop->UnlockSingleWindow(); // TODO: possible deadlock if (eventMask != 0 || options != 0) { fDesktop->EventDispatcher().AddTemporaryListener(EventTarget(), - fCurrentLayer->Token(), eventMask, options); + fCurrentView->Token(), eventMask, options); } else { fDesktop->EventDispatcher().RemoveTemporaryListener(EventTarget(), - fCurrentLayer->Token()); + fCurrentView->Token()); } fDesktop->LockSingleWindow(); } @@ -1337,97 +1337,97 @@ fDesktop->LockSingleWindow(); } case AS_LAYER_MOVE_TO: { - STRACE(("ServerWindow %s: Message AS_LAYER_MOVE_TO: ViewLayer name: %s\n", - fTitle, fCurrentLayer->Name())); + STRACE(("ServerWindow %s: Message AS_LAYER_MOVE_TO: View name: %s\n", + fTitle, fCurrentView->Name())); float x, y; link.Read(&x); link.Read(&y); - float offsetX = x - fCurrentLayer->Frame().left; - float offsetY = y - fCurrentLayer->Frame().top; + float offsetX = x - fCurrentView->Frame().left; + float offsetY = y - fCurrentView->Frame().top; BRegion dirty; - fCurrentLayer->MoveBy(offsetX, offsetY, &dirty); + fCurrentView->MoveBy(offsetX, offsetY, &dirty); // TODO: think about how to avoid this hack: // the parent clipping needs to be updated, it is not // done in MoveBy() since it would cause // too much computations when children are resized because // follow modes - if (ViewLayer* parent = fCurrentLayer->Parent()) + if (View* parent = fCurrentView->Parent()) parent->RebuildClipping(false); - fWindowLayer->MarkContentDirty(dirty); + fWindow->MarkContentDirty(dirty); break; } case AS_LAYER_RESIZE_TO: { - STRACE(("ServerWindow %s: Message AS_LAYER_RESIZE_TO: ViewLayer name: %s\n", - fTitle, fCurrentLayer->Name())); + STRACE(("ServerWindow %s: Message AS_LAYER_RESIZE_TO: View name: %s\n", + fTitle, fCurrentView->Name())); float newWidth, newHeight; link.Read(&newWidth); link.Read(&newHeight); - float deltaWidth = newWidth - fCurrentLayer->Frame().Width(); - float deltaHeight = newHeight - fCurrentLayer->Frame().Height(); + float deltaWidth = newWidth - fCurrentView->Frame().Width(); + float deltaHeight = newHeight - fCurrentView->Frame().Height(); BRegion dirty; - fCurrentLayer->ResizeBy(deltaWidth, deltaHeight, &dirty); + fCurrentView->ResizeBy(deltaWidth, deltaHeight, &dirty); // TODO: see above - if (ViewLayer* parent = fCurrentLayer->Parent()) + if (View* parent = fCurrentView->Parent()) parent->RebuildClipping(false); - fWindowLayer->MarkContentDirty(dirty); + fWindow->MarkContentDirty(dirty); break; } case AS_LAYER_GET_COORD: { - STRACE(("ServerWindow %s: Message AS_LAYER_GET_COORD: ViewLayer: %s\n", Title(), fCurrentLayer->Name())); + STRACE(("ServerWindow %s: Message AS_LAYER_GET_COORD: View: %s\n", Title(), fCurrentView->Name())); fLink.StartMessage(B_OK); // our offset in the parent -> will be originX and originY in BView - BPoint parentOffset = fCurrentLayer->Frame().LeftTop(); + BPoint parentOffset = fCurrentView->Frame().LeftTop(); fLink.Attach(parentOffset); - fLink.Attach(fCurrentLayer->Bounds()); + fLink.Attach(fCurrentView->Bounds()); fLink.Flush(); break; } case AS_LAYER_SET_ORIGIN: { - STRACE(("ServerWindow %s: Message AS_LAYER_SET_ORIGIN: ViewLayer: %s\n", Title(), fCurrentLayer->Name())); + STRACE(("ServerWindow %s: Message AS_LAYER_SET_ORIGIN: View: %s\n", Title(), fCurrentView->Name())); float x, y; link.Read(&x); link.Read(&y); - fCurrentLayer->SetDrawingOrigin(BPoint(x, y)); - _UpdateDrawState(fCurrentLayer); + fCurrentView->SetDrawingOrigin(BPoint(x, y)); + _UpdateDrawState(fCurrentView); break; } case AS_LAYER_GET_ORIGIN: { - STRACE(("ServerWindow %s: Message AS_LAYER_GET_ORIGIN: ViewLayer: %s\n", Title(), fCurrentLayer->Name())); + STRACE(("ServerWindow %s: Message AS_LAYER_GET_ORIGIN: View: %s\n", Title(), fCurrentView->Name())); fLink.StartMessage(B_OK); - fLink.Attach(fCurrentLayer->DrawingOrigin()); + fLink.Attach(fCurrentView->DrawingOrigin()); fLink.Flush(); break; } case AS_LAYER_RESIZE_MODE: { - STRACE(("ServerWindow %s: Message AS_LAYER_RESIZE_MODE: ViewLayer: %s\n", - Title(), fCurrentLayer->Name())); + STRACE(("ServerWindow %s: Message AS_LAYER_RESIZE_MODE: View: %s\n", + Title(), fCurrentView->Name())); uint32 resizeMode; if (link.Read(&resizeMode) == B_OK) - fCurrentLayer->SetResizeMode(resizeMode); + fCurrentView->SetResizeMode(resizeMode); break; } case AS_LAYER_SET_CURSOR: { - DTRACE(("ServerWindow %s: Message AS_LAYER_CURSOR: ViewLayer: %s\n", Title(), - fCurrentLayer->Name())); + DTRACE(("ServerWindow %s: Message AS_LAYER_CURSOR: View: %s\n", Title(), + fCurrentView->Name())); int32 token; bool sync; @@ -1439,13 +1439,13 @@ fDesktop->LockSingleWindow(); break; ServerCursor* cursor = fDesktop->GetCursorManager().FindCursor(token); - fCurrentLayer->SetCursor(cursor); + fCurrentView->SetCursor(cursor); fDesktop->GetCursorManager().Unlock(); - if (fWindowLayer->IsFocus()) { + if (fWindow->IsFocus()) { // The cursor might need to be updated now - if (fDesktop->ViewUnderMouse(fWindowLayer) == fCurrentLayer->Token()) + if (fDesktop->ViewUnderMouse(fWindow) == fCurrentView->Token()) fServerApp->SetCurrentCursor(cursor); } if (sync) { @@ -1460,27 +1460,27 @@ fDesktop->LockSingleWindow(); { uint32 flags; link.Read(&flags); - fCurrentLayer->SetFlags(flags); - _UpdateDrawState(fCurrentLayer); + fCurrentView->SetFlags(flags); + _UpdateDrawState(fCurrentView); - STRACE(("ServerWindow %s: Message AS_LAYER_SET_FLAGS: ViewLayer: %s\n", Title(), fCurrentLayer->Name())); + STRACE(("ServerWindow %s: Message AS_LAYER_SET_FLAGS: View: %s\n", Title(), fCurrentView->Name())); break; } case AS_LAYER_HIDE: { - STRACE(("ServerWindow %s: Message AS_LAYER_HIDE: ViewLayer: %s\n", Title(), fCurrentLayer->Name())); - fCurrentLayer->SetHidden(true); + STRACE(("ServerWindow %s: Message AS_LAYER_HIDE: View: %s\n", Title(), fCurrentView->Name())); + fCurrentView->SetHidden(true); break; } case AS_LAYER_SHOW: { - STRACE(("ServerWindow %s: Message AS_LAYER_SHOW: ViewLayer: %s\n", Title(), fCurrentLayer->Name())); - fCurrentLayer->SetHidden(false); + STRACE(("ServerWindow %s: Message AS_LAYER_SHOW: View: %s\n", Title(), fCurrentView->Name())); + fCurrentView->SetHidden(false); break; } case AS_LAYER_SET_LINE_MODE: { - DTRACE(("ServerWindow %s: Message AS_LAYER_SET_LINE_MODE: ViewLayer: %s\n", Title(), fCurrentLayer->Name())); + DTRACE(("ServerWindow %s: Message AS_LAYER_SET_LINE_MODE: View: %s\n", Title(), fCurrentView->Name())); int8 lineCap, lineJoin; float miterLimit; @@ -1488,184 +1488,184 @@ fDesktop->LockSingleWindow(); link.Read(&lineJoin); link.Read(&miterLimit); - fCurrentLayer->CurrentState()->SetLineCapMode((cap_mode)lineCap); - fCurrentLayer->CurrentState()->SetLineJoinMode((join_mode)lineJoin); - fCurrentLayer->CurrentState()->SetMiterLimit(miterLimit); + fCurrentView->CurrentState()->SetLineCapMode((cap_mode)lineCap); + fCurrentView->CurrentState()->SetLineJoinMode((join_mode)lineJoin); + fCurrentView->CurrentState()->SetMiterLimit(miterLimit); - fWindowLayer->GetDrawingEngine()->SetStrokeMode((cap_mode)lineCap, + fWindow->GetDrawingEngine()->SetStrokeMode((cap_mode)lineCap, (join_mode)lineJoin, miterLimit); -// _UpdateDrawState(fCurrentLayer); +// _UpdateDrawState(fCurrentView); break; } case AS_LAYER_GET_LINE_MODE: { - DTRACE(("ServerWindow %s: Message AS_LAYER_GET_LINE_MODE: ViewLayer: %s\n", Title(), fCurrentLayer->Name())); + DTRACE(("ServerWindow %s: Message AS_LAYER_GET_LINE_MODE: View: %s\n", Title(), fCurrentView->Name())); fLink.StartMessage(B_OK); - fLink.Attach((int8)(fCurrentLayer->CurrentState()->LineCapMode())); - fLink.Attach((int8)(fCurrentLayer->CurrentState()->LineJoinMode())); - fLink.Attach(fCurrentLayer->CurrentState()->MiterLimit()); + fLink.Attach((int8)(fCurrentView->CurrentState()->LineCapMode())); + fLink.Attach((int8)(fCurrentView->CurrentState()->LineJoinMode())); + fLink.Attach(fCurrentView->CurrentState()->MiterLimit()); fLink.Flush(); break; } case AS_LAYER_PUSH_STATE: { - DTRACE(("ServerWindow %s: Message AS_LAYER_PUSH_STATE: ViewLayer: %s\n", Title(), fCurrentLayer->Name())); + DTRACE(("ServerWindow %s: Message AS_LAYER_PUSH_STATE: View: %s\n", Title(), fCurrentView->Name())); - fCurrentLayer->PushState(); + fCurrentView->PushState(); // TODO: is this necessary? - _UpdateDrawState(fCurrentLayer); + _UpdateDrawState(fCurrentView); break; } case AS_LAYER_POP_STATE: { - DTRACE(("ServerWindow %s: Message AS_LAYER_POP_STATE: ViewLayer: %s\n", Title(), fCurrentLayer->Name())); + DTRACE(("ServerWindow %s: Message AS_LAYER_POP_STATE: View: %s\n", Title(), fCurrentView->Name())); - fCurrentLayer->PopState(); - _UpdateDrawState(fCurrentLayer); + fCurrentView->PopState(); + _UpdateDrawState(fCurrentView); break; } case AS_LAYER_SET_SCALE: { - DTRACE(("ServerWindow %s: Message AS_LAYER_SET_SCALE: ViewLayer: %s\n", Title(), fCurrentLayer->Name())); + DTRACE(("ServerWindow %s: Message AS_LAYER_SET_SCALE: View: %s\n", Title(), fCurrentView->Name())); float scale; link.Read(&scale); - fCurrentLayer->SetScale(scale); - _UpdateDrawState(fCurrentLayer); + fCurrentView->SetScale(scale); + _UpdateDrawState(fCurrentView); break; } case AS_LAYER_GET_SCALE: { - DTRACE(("ServerWindow %s: Message AS_LAYER_GET_SCALE: ViewLayer: %s\n", Title(), fCurrentLayer->Name())); + DTRACE(("ServerWindow %s: Message AS_LAYER_GET_SCALE: View: %s\n", Title(), fCurrentView->Name())); fLink.StartMessage(B_OK); - fLink.Attach(fCurrentLayer->CurrentState()->Scale()); + fLink.Attach(fCurrentView->CurrentState()->Scale()); fLink.Flush(); break; } case AS_LAYER_SET_PEN_LOC: { - DTRACE(("ServerWindow %s: Message AS_LAYER_SET_PEN_LOC: ViewLayer: %s\n", Title(), fCurrentLayer->Name())); + DTRACE(("ServerWindow %s: Message AS_LAYER_SET_PEN_LOC: View: %s\n", Title(), fCurrentView->Name())); float x, y; link.Read(&x); link.Read(&y); - fCurrentLayer->CurrentState()->SetPenLocation(BPoint(x, y)); + fCurrentView->CurrentState()->SetPenLocation(BPoint(x, y)); break; } case AS_LAYER_GET_PEN_LOC: { - DTRACE(("ServerWindow %s: Message AS_LAYER_GET_PEN_LOC: ViewLayer: %s\n", Title(), fCurrentLayer->Name())); + DTRACE(("ServerWindow %s: Message AS_LAYER_GET_PEN_LOC: View: %s\n", Title(), fCurrentView->Name())); fLink.StartMessage(B_OK); - fLink.Attach(fCurrentLayer->CurrentState()->PenLocation()); + fLink.Attach(fCurrentView->CurrentState()->PenLocation()); fLink.Flush(); break; } case AS_LAYER_SET_PEN_SIZE: { - DTRACE(("ServerWindow %s: Message AS_LAYER_SET_PEN_SIZE: ViewLayer: %s\n", Title(), fCurrentLayer->Name())); + DTRACE(("ServerWindow %s: Message AS_LAYER_SET_PEN_SIZE: View: %s\n", Title(), fCurrentView->Name())); float penSize; link.Read(&penSize); - fCurrentLayer->CurrentState()->SetPenSize(penSize); - fWindowLayer->GetDrawingEngine()->SetPenSize( - fCurrentLayer->CurrentState()->PenSize()); + fCurrentView->CurrentState()->SetPenSize(penSize); + fWindow->GetDrawingEngine()->SetPenSize( + fCurrentView->CurrentState()->PenSize()); break; } case AS_LAYER_GET_PEN_SIZE: { - DTRACE(("ServerWindow %s: Message AS_LAYER_GET_PEN_SIZE: ViewLayer: %s\n", Title(), fCurrentLayer->Name())); + DTRACE(("ServerWindow %s: Message AS_LAYER_GET_PEN_SIZE: View: %s\n", Title(), fCurrentView->Name())); fLink.StartMessage(B_OK); fLink.Attach( - fCurrentLayer->CurrentState()->UnscaledPenSize()); + fCurrentView->CurrentState()->UnscaledPenSize()); fLink.Flush(); break; } case AS_LAYER_SET_VIEW_COLOR: { - DTRACE(("ServerWindow %s: Message AS_LAYER_SET_VIEW_COLOR: ViewLayer: %s\n", Title(), fCurrentLayer->Name())); + DTRACE(("ServerWindow %s: Message AS_LAYER_SET_VIEW_COLOR: View: %s\n", Title(), fCurrentView->Name())); rgb_color c; link.Read(&c, sizeof(rgb_color)); - fCurrentLayer->SetViewColor(c); + fCurrentView->SetViewColor(c); break; } case AS_LAYER_GET_HIGH_COLOR: - DTRACE(("ServerWindow %s: Message AS_LAYER_GET_HIGH_COLOR: ViewLayer: %s\n", - Title(), fCurrentLayer->Name())); + DTRACE(("ServerWindow %s: Message AS_LAYER_GET_HIGH_COLOR: View: %s\n", + Title(), fCurrentView->Name())); fLink.StartMessage(B_OK); - fLink.Attach(fCurrentLayer->CurrentState()->HighColor()); + fLink.Attach(fCurrentView->CurrentState()->HighColor()); fLink.Flush(); break; case AS_LAYER_GET_LOW_COLOR: - DTRACE(("ServerWindow %s: Message AS_LAYER_GET_LOW_COLOR: ViewLayer: %s\n", - Title(), fCurrentLayer->Name())); + DTRACE(("ServerWindow %s: Message AS_LAYER_GET_LOW_COLOR: View: %s\n", + Title(), fCurrentView->Name())); fLink.StartMessage(B_OK); - fLink.Attach(fCurrentLayer->CurrentState()->LowColor()); + fLink.Attach(fCurrentView->CurrentState()->LowColor()); fLink.Flush(); break; case AS_LAYER_GET_VIEW_COLOR: - DTRACE(("ServerWindow %s: Message AS_LAYER_GET_VIEW_COLOR: ViewLayer: %s\n", - Title(), fCurrentLayer->Name())); + DTRACE(("ServerWindow %s: Message AS_LAYER_GET_VIEW_COLOR: View: %s\n", + Title(), fCurrentView->Name())); fLink.StartMessage(B_OK); - fLink.Attach(fCurrentLayer->ViewColor()); + fLink.Attach(fCurrentView->ViewColor()); fLink.Flush(); break; case AS_LAYER_SET_BLENDING_MODE: { - DTRACE(("ServerWindow %s: Message AS_LAYER_SET_BLEND_MODE: ViewLayer: %s\n", Title(), fCurrentLayer->Name())); + DTRACE(("ServerWindow %s: Message AS_LAYER_SET_BLEND_MODE: View: %s\n", Title(), fCurrentView->Name())); int8 srcAlpha, alphaFunc; link.Read(&srcAlpha); link.Read(&alphaFunc); - fCurrentLayer->CurrentState()->SetBlendingMode((source_alpha)srcAlpha, + fCurrentView->CurrentState()->SetBlendingMode((source_alpha)srcAlpha, (alpha_function)alphaFunc); - //_UpdateDrawState(fCurrentLayer); - fWindowLayer->GetDrawingEngine()->SetBlendingMode((source_alpha)srcAlpha, + //_UpdateDrawState(fCurrentView); + fWindow->GetDrawingEngine()->SetBlendingMode((source_alpha)srcAlpha, (alpha_function)alphaFunc); break; } case AS_LAYER_GET_BLENDING_MODE: { - DTRACE(("ServerWindow %s: Message AS_LAYER_GET_BLEND_MODE: ViewLayer: %s\n", Title(), fCurrentLayer->Name())); + DTRACE(("ServerWindow %s: Message AS_LAYER_GET_BLEND_MODE: View: %s\n", Title(), fCurrentView->Name())); fLink.StartMessage(B_OK); - fLink.Attach((int8)(fCurrentLayer->CurrentState()->AlphaSrcMode())); - fLink.Attach((int8)(fCurrentLayer->CurrentState()->AlphaFncMode())); + fLink.Attach((int8)(fCurrentView->CurrentState()->AlphaSrcMode())); + fLink.Attach((int8)(fCurrentView->CurrentState()->AlphaFncMode())); fLink.Flush(); break; } case AS_LAYER_SET_DRAWING_MODE: { - DTRACE(("ServerWindow %s: Message AS_LAYER_SET_DRAW_MODE: ViewLayer: %s\n", Title(), fCurrentLayer->Name())); + DTRACE(("ServerWindow %s: Message AS_LAYER_SET_DRAW_MODE: View: %s\n", Title(), fCurrentView->Name())); int8 drawingMode; link.Read(&drawingMode); - fCurrentLayer->CurrentState()->SetDrawingMode((drawing_mode)drawingMode); - //_UpdateDrawState(fCurrentLayer); - fWindowLayer->GetDrawingEngine()->SetDrawingMode((drawing_mode)drawingMode); + fCurrentView->CurrentState()->SetDrawingMode((drawing_mode)drawingMode); + //_UpdateDrawState(fCurrentView); + fWindow->GetDrawingEngine()->SetDrawingMode((drawing_mode)drawingMode); break; } case AS_LAYER_GET_DRAWING_MODE: { - DTRACE(("ServerWindow %s: Message AS_LAYER_GET_DRAW_MODE: ViewLayer: %s\n", Title(), fCurrentLayer->Name())); + DTRACE(("ServerWindow %s: Message AS_LAYER_GET_DRAW_MODE: View: %s\n", Title(), fCurrentView->Name())); fLink.StartMessage(B_OK); - fLink.Attach((int8)(fCurrentLayer->CurrentState()->GetDrawingMode())); + fLink.Attach((int8)(fCurrentView->CurrentState()->GetDrawingMode())); fLink.Flush(); break; @@ -1686,22 +1686,22 @@ fDesktop->LockSingleWindow(); if (status == B_OK) { ServerBitmap* bitmap = fServerApp->FindBitmap(bitmapToken); if (bitmapToken == -1 || bitmap != NULL) { - bool wasOverlay = fCurrentLayer->ViewBitmap() != NULL - && fCurrentLayer->ViewBitmap()->Overlay() != NULL; + bool wasOverlay = fCurrentView->ViewBitmap() != NULL + && fCurrentView->ViewBitmap()->Overlay() != NULL; // TODO: this is a race condition: the bitmap could have been // deleted in the mean time!! - fCurrentLayer->SetViewBitmap(bitmap, srcRect, dstRect, + fCurrentView->SetViewBitmap(bitmap, srcRect, dstRect, resizingMode, options); // TODO: if we revert the view color overlay handling - // in ViewLayer::Draw() to the R5 version, we never + // in View::Draw() to the R5 version, we never // need to invalidate the view for overlays. // invalidate view - but only if this is a non-overlay switch if (bitmap == NULL || bitmap->Overlay() == NULL || !wasOverlay) { - BRegion dirty((BRect)fCurrentLayer->Bounds()); - fWindowLayer->InvalidateView(fCurrentLayer, dirty); + BRegion dirty((BRect)fCurrentView->Bounds()); + fWindow->InvalidateView(fCurrentView, dirty); } if (bitmap != NULL && bitmap->Overlay() != NULL) { @@ -1723,18 +1723,18 @@ fDesktop->LockSingleWindow(); } case AS_LAYER_PRINT_ALIASING: { - DTRACE(("ServerWindow %s: Message AS_LAYER_PRINT_ALIASING: ViewLayer: %s\n", Title(), fCurrentLayer->Name())); + DTRACE(("ServerWindow %s: Message AS_LAYER_PRINT_ALIASING: View: %s\n", Title(), fCurrentView->Name())); bool fontAliasing; if (link.Read(&fontAliasing) == B_OK) { - fCurrentLayer->CurrentState()->SetForceFontAliasing(fontAliasing); - _UpdateDrawState(fCurrentLayer); + fCurrentView->CurrentState()->SetForceFontAliasing(fontAliasing); + _UpdateDrawState(fCurrentView); } break; } case AS_LAYER_CLIP_TO_PICTURE: { - DTRACE(("ServerWindow %s: Message AS_LAYER_CLIP_TO_PICTURE: ViewLayer: %s\n", Title(), fCurrentLayer->Name())); - // TODO: you are not allowed to use ViewLayer regions here!!! + DTRACE(("ServerWindow %s: Message AS_LAYER_CLIP_TO_PICTURE: View: %s\n", Title(), fCurrentView->Name())); + // TODO: you are not allowed to use View regions here!!! int32 pictureToken; BPoint where; @@ -1752,22 +1752,22 @@ fDesktop->LockSingleWindow(); BRegion region; // TODO: I think we also need the BView's token - // I think PictureToRegion would fit better into the ViewLayer class (?) + // I think PictureToRegion would fit better into the View class (?) if (PictureToRegion(picture, region, inverse, where) < B_OK) break; - fCurrentLayer->SetUserClipping(®ion); + fCurrentView->SetUserClipping(®ion); // TODO: reenable AS_LAYER_CLIP_TO_PICTURE #if 0 - if (rootLayer && !(fCurrentLayer->IsHidden()) && !fWindowLayer->InUpdate()) { + if (rootLayer && !(fCurrentView->IsHidden()) && !fWindow->InUpdate()) { BRegion invalidRegion; - fCurrentLayer->GetOnScreenRegion(invalidRegion); + fCurrentView->GetOnScreenRegion(invalidRegion); // TODO: this is broken! a smaller area may be invalidated! - fCurrentLayer->fParent->MarkForRebuild(invalidRegion); - fCurrentLayer->fParent->TriggerRebuild(); + fCurrentView->fParent->MarkForRebuild(invalidRegion); + fCurrentView->fParent->TriggerRebuild(); rootLayer->MarkForRedraw(invalidRegion); rootLayer->TriggerRedraw(); } @@ -1777,15 +1777,15 @@ fDesktop->LockSingleWindow(); case AS_LAYER_GET_CLIP_REGION: { - DTRACE(("ServerWindow %s: Message AS_LAYER_GET_CLIP_REGION: ViewLayer: %s\n", Title(), fCurrentLayer->Name())); + DTRACE(("ServerWindow %s: Message AS_LAYER_GET_CLIP_REGION: View: %s\n", Title(), fCurrentView->Name())); - // if this ViewLayer is hidden, it is clear that its visible region is void. + // if this View is hidden, it is clear that its visible region is void. fLink.StartMessage(B_OK); - if (fCurrentLayer->IsHidden()) { + if (fCurrentView->IsHidden()) { BRegion empty; fLink.AttachRegion(empty); } else { - BRegion drawingRegion = fCurrentLayer->LocalClipping(); + BRegion drawingRegion = fCurrentView->LocalClipping(); fLink.AttachRegion(drawingRegion); } fLink.Flush(); @@ -1794,7 +1794,7 @@ fDesktop->LockSingleWindow(); } case AS_LAYER_SET_CLIP_REGION: { - DTRACE(("ServerWindow %s: Message AS_LAYER_SET_CLIP_REGION: ViewLayer: %s\n", Title(), fCurrentLayer->Name())); + DTRACE(("ServerWindow %s: Message AS_LAYER_SET_CLIP_REGION: View: %s\n", Title(), fCurrentView->Name())); int32 rectCount; status_t status = link.Read(&rectCount); @@ -1811,12 +1811,12 @@ fDesktop->LockSingleWindow(); BRegion region; if (rectCount > 0 && link.ReadRegion(®ion) < B_OK) break; - fCurrentLayer->SetUserClipping(®ion); + fCurrentView->SetUserClipping(®ion); } else { // we are supposed to unset the clipping region // passing NULL sets this states region to that // of the previous state - fCurrentLayer->SetUserClipping(NULL); + fCurrentView->SetUserClipping(NULL); } fCurrentDrawingRegionValid = false; @@ -1825,20 +1825,20 @@ fDesktop->LockSingleWindow(); case AS_LAYER_INVALIDATE_RECT: { - DTRACE(("ServerWindow %s: Message AS_LAYER_INVALIDATE_RECT: ViewLayer: %s\n", Title(), fCurrentLayer->Name())); + DTRACE(("ServerWindow %s: Message AS_LAYER_INVALIDATE_RECT: View: %s\n", Title(), fCurrentView->Name())); // NOTE: looks like this call is NOT affected by origin and scale on R5 // so this implementation is "correct" BRect invalidRect; if (link.Read(&invalidRect) == B_OK) { BRegion dirty(invalidRect); - fWindowLayer->InvalidateView(fCurrentLayer, dirty); + fWindow->InvalidateView(fCurrentView, dirty); } break; } case AS_LAYER_INVALIDATE_REGION: { - DTRACE(("ServerWindow %s: Message AS_LAYER_INVALIDATE_RECT: ViewLayer: %s\n", Title(), fCurrentLayer->Name())); + DTRACE(("ServerWindow %s: Message AS_LAYER_INVALIDATE_RECT: View: %s\n", Title(), fCurrentView->Name())); // NOTE: looks like this call is NOT affected by origin and scale on R5 // so this implementation is "correct" @@ -1846,41 +1846,41 @@ fDesktop->LockSingleWindow(); if (link.ReadRegion(®ion) < B_OK) break; - fWindowLayer->InvalidateView(fCurrentLayer, region); + fWindow->InvalidateView(fCurrentView, region); break; } case AS_LAYER_SET_HIGH_COLOR: { - DTRACE(("ServerWindow %s: Message AS_LAYER_SET_HIGH_COLOR: ViewLayer: %s\n", Title(), fCurrentLayer->Name())); + DTRACE(("ServerWindow %s: Message AS_LAYER_SET_HIGH_COLOR: View: %s\n", Title(), fCurrentView->Name())); rgb_color c; link.Read(&c, sizeof(rgb_color)); - fCurrentLayer->CurrentState()->SetHighColor(c); - fWindowLayer->GetDrawingEngine()->SetHighColor(c); + fCurrentView->CurrentState()->SetHighColor(c); + fWindow->GetDrawingEngine()->SetHighColor(c); break; } case AS_LAYER_SET_LOW_COLOR: { - DTRACE(("ServerWindow %s: Message AS_LAYER_SET_LOW_COLOR: ViewLayer: %s\n", Title(), fCurrentLayer->Name())); + DTRACE(("ServerWindow %s: Message AS_LAYER_SET_LOW_COLOR: View: %s\n", Title(), fCurrentView->Name())); rgb_color c; link.Read(&c, sizeof(rgb_color)); - fCurrentLayer->CurrentState()->SetLowColor(c); - fWindowLayer->GetDrawingEngine()->SetLowColor(c); + fCurrentView->CurrentState()->SetLowColor(c); + fWindow->GetDrawingEngine()->SetLowColor(c); break; } case AS_LAYER_SET_PATTERN: { - DTRACE(("ServerWindow %s: Message AS_LAYER_SET_PATTERN: ViewLayer: %s\n", fTitle, fCurrentLayer->Name())); + DTRACE(("ServerWindow %s: Message AS_LAYER_SET_PATTERN: View: %s\n", fTitle, fCurrentView->Name())); pattern pat; link.Read(&pat, sizeof(pattern)); - fCurrentLayer->CurrentState()->SetPattern(Pattern(pat)); - fWindowLayer->GetDrawingEngine()->SetPattern(pat); + fCurrentView->CurrentState()->SetPattern(Pattern(pat)); + fWindow->GetDrawingEngine()->SetPattern(pat); break; } case AS_LAYER_DRAG_IMAGE: @@ -1973,8 +1973,8 @@ fDesktop->LockSingleWindow(); { DTRACE(("ServerWindow %s: Message AS_LAYER_BEGIN_PICTURE\n", Title())); ServerPicture *picture = App()->CreatePicture(); - picture->SyncState(fCurrentLayer); - fCurrentLayer->SetPicture(picture); + picture->SyncState(fCurrentView); + fCurrentView->SetPicture(picture); break; } @@ -1986,8 +1986,8 @@ fDesktop->LockSingleWindow(); link.Read(&pictureToken); ServerPicture *picture = App()->FindPicture(pictureToken); if (picture) - picture->SyncState(fCurrentLayer); - fCurrentLayer->SetPicture(picture); + picture->SyncState(fCurrentView); + fCurrentView->SetPicture(picture); // we don't care if it's NULL break; } @@ -1996,9 +1996,9 @@ fDesktop->LockSingleWindow(); { DTRACE(("ServerWindow %s: Message AS_LAYER_END_PICTURE\n", Title())); - ServerPicture *picture = fCurrentLayer->Picture(); + ServerPicture *picture = fCurrentView->Picture(); if (picture != NULL) { - fCurrentLayer->SetPicture(NULL); + fCurrentView->SetPicture(NULL); fLink.StartMessage(B_OK); fLink.Attach(picture->Token()); } else @@ -2018,12 +2018,12 @@ fDesktop->LockSingleWindow(); /*! Dispatches all view drawing messages. The desktop clipping must be read locked when entering this method. - Requires a valid fCurrentLayer. + Requires a valid fCurrentView. */ void ServerWindow::_DispatchViewDrawingMessage(int32 code, BPrivate::LinkReceiver &link) { - if (!fCurrentLayer->IsVisible() || !fWindowLayer->IsVisible()) { + if (!fCurrentView->IsVisible() || !fWindow->IsVisible()) { if (link.NeedsReply()) { printf("ServerWindow::DispatchViewDrawingMessage() got message %ld that needs a reply!\n", code); // the client is now blocking and waiting for a reply! @@ -2033,7 +2033,7 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code, BPrivate::LinkReceiver &li return; } - DrawingEngine* drawingEngine = fWindowLayer->GetDrawingEngine(); + DrawingEngine* drawingEngine = fWindow->GetDrawingEngine(); if (!drawingEngine) { // ?!? DTRACE(("ServerWindow %s: no drawing engine!!\n", Title())); @@ -2045,8 +2045,8 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code, BPrivate::LinkReceiver &li return; } - if (!fCurrentDrawingRegionValid || fWindowLayer->DrawingRegionChanged(fCurrentLayer)) { - fWindowLayer->GetEffectiveDrawingRegion(fCurrentLayer, fCurrentDrawingRegion); + if (!fCurrentDrawingRegionValid || fWindow->DrawingRegionChanged(fCurrentView)) { + fWindow->GetEffectiveDrawingRegion(fCurrentView, fCurrentDrawingRegion); fCurrentDrawingRegionValid = true; } @@ -2080,8 +2080,8 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code, BPrivate::LinkReceiver &li BPoint p1(x1, y1); BPoint p2(x2, y2); BPoint penPos = p2; - fCurrentLayer->ConvertToScreenForDrawing(&p1); - fCurrentLayer->ConvertToScreenForDrawing(&p2); + fCurrentView->ConvertToScreenForDrawing(&p1); + fCurrentView->ConvertToScreenForDrawing(&p2); drawingEngine->StrokeLine(p1, p2); // We update the pen here because many DrawingEngine calls which do not update the @@ -2090,7 +2090,7 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code, BPrivate::LinkReceiver &li // TODO: Decide where to put this, for example, it cannot be done // for DrawString(), also there needs to be a decision, if penlocation // is in View coordinates (I think it should be) or in screen coordinates. - fCurrentLayer->CurrentState()->SetPenLocation(penPos); + fCurrentView->CurrentState()->SetPenLocation(penPos); break; } case AS_LAYER_INVERT_RECT: @@ -2100,7 +2100,7 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code, BPrivate::LinkReceiver &li BRect rect; link.Read(&rect); - fCurrentLayer->ConvertToScreenForDrawing(&rect); + fCurrentView->ConvertToScreenForDrawing(&rect); drawingEngine->InvertRect(rect); break; } @@ -2111,7 +2111,7 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code, BPrivate::LinkReceiver &li BRect rect; link.Read(&rect); - fCurrentLayer->ConvertToScreenForDrawing(&rect); + fCurrentView->ConvertToScreenForDrawing(&rect); drawingEngine->StrokeRect(rect); break; } @@ -2122,13 +2122,13 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code, BPrivate::LinkReceiver &li BRect rect; link.Read(&rect); - fCurrentLayer->ConvertToScreenForDrawing(&rect); + fCurrentView->ConvertToScreenForDrawing(&rect); drawingEngine->FillRect(rect); break; } case AS_LAYER_DRAW_BITMAP: { - DTRACE(("ServerWindow %s: Message AS_LAYER_DRAW_BITMAP: ViewLayer name: %s\n", fTitle, fCurrentLayer->Name())); + DTRACE(("ServerWindow %s: Message AS_LAYER_DRAW_BITMAP: View name: %s\n", fTitle, fCurrentView->Name())); int32 bitmapToken; BRect srcRect, dstRect; @@ -2138,7 +2138,7 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code, BPrivate::LinkReceiver &li ServerBitmap* bitmap = fServerApp->FindBitmap(bitmapToken); if (bitmap) { - fCurrentLayer->ConvertToScreenForDrawing(&dstRect); + fCurrentView->ConvertToScreenForDrawing(&dstRect); drawingEngine->DrawBitmap(bitmap, srcRect, dstRect); } @@ -2157,7 +2157,7 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code, BPrivate::LinkReceiver &li link.Read(&angle); link.Read(&span); - fCurrentLayer->ConvertToScreenForDrawing(&r); + fCurrentView->ConvertToScreenForDrawing(&r); drawingEngine->DrawArc(r, angle, span, code == AS_FILL_ARC); break; } @@ -2169,7 +2169,7 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code, BPrivate::LinkReceiver &li BPoint pts[4]; for (int32 i = 0; i < 4; i++) { link.Read(&(pts[i])); - fCurrentLayer->ConvertToScreenForDrawing(&pts[i]); + fCurrentView->ConvertToScreenForDrawing(&pts[i]); } drawingEngine->DrawBezier(pts, code == AS_FILL_BEZIER); @@ -2183,7 +2183,7 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code, BPrivate::LinkReceiver &li BRect rect; link.Read(&rect); - fCurrentLayer->ConvertToScreenForDrawing(&rect); + fCurrentView->ConvertToScreenForDrawing(&rect); drawingEngine->DrawEllipse(rect, code == AS_FILL_ELLIPSE); break; } @@ -2198,7 +2198,7 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code, BPrivate::LinkReceiver &li link.Read(&xrad); link.Read(&yrad); - fCurrentLayer->ConvertToScreenForDrawing(&rect); + fCurrentView->ConvertToScreenForDrawing(&rect); drawingEngine->DrawRoundRect(rect, xrad, yrad, code == AS_FILL_ROUNDRECT); break; } @@ -2212,12 +2212,12 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code, BPrivate::LinkReceiver &li for (int32 i = 0; i < 3; i++) { link.Read(&(pts[i])); - fCurrentLayer->ConvertToScreenForDrawing(&pts[i]); + fCurrentView->ConvertToScreenForDrawing(&pts[i]); } link.Read(&rect); - fCurrentLayer->ConvertToScreenForDrawing(&rect); + fCurrentView->ConvertToScreenForDrawing(&rect); drawingEngine->DrawTriangle(pts, rect, code == AS_FILL_TRIANGLE); break; } @@ -2238,8 +2238,8 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code, BPrivate::LinkReceiver &li BPoint* pointList = new(nothrow) BPoint[pointCount]; if (link.Read(pointList, pointCount * sizeof(BPoint)) >= B_OK) { for (int32 i = 0; i < pointCount; i++) - fCurrentLayer->ConvertToScreenForDrawing(&pointList[i]); - fCurrentLayer->ConvertToScreenForDrawing(&polyFrame); + fCurrentView->ConvertToScreenForDrawing(&pointList[i]); + fCurrentView->ConvertToScreenForDrawing(&polyFrame); drawingEngine->DrawPolygon(pointList, pointCount, polyFrame, code == AS_FILL_POLYGON, isClosed && pointCount > 2); @@ -2267,10 +2267,10 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code, BPrivate::LinkReceiver &li // this might seem a bit weird, but under R5, the shapes // are always offset by the current pen location - BPoint penLocation = fCurrentLayer->CurrentState()->PenLocation(); + BPoint penLocation = fCurrentView->CurrentState()->PenLocation(); for (int32 i = 0; i < ptCount; i++) { ptList[i] += penLocation; - fCurrentLayer->ConvertToScreenForDrawing(&ptList[i]); + fCurrentView->ConvertToScreenForDrawing(&ptList[i]); } drawingEngine->DrawShape(shapeFrame, opCount, opList, ptCount, ptList, @@ -2289,7 +2289,7 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code, BPrivate::LinkReceiver &li if (link.ReadRegion(®ion) < B_OK) break; - fCurrentLayer->ConvertToScreenForDrawing(®ion); + fCurrentView->ConvertToScreenForDrawing(®ion); drawingEngine->FillRegion(region); break; @@ -2317,8 +2317,8 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code, BPrivate::LinkReceiver &li link.Read(&(index->pt2.y)); link.Read(&(index->color)); - fCurrentLayer->ConvertToScreenForDrawing(&index->pt1); - fCurrentLayer->ConvertToScreenForDrawing(&index->pt2); + fCurrentView->ConvertToScreenForDrawing(&index->pt1); + fCurrentView->ConvertToScreenForDrawing(&index->pt2); } drawingEngine->StrokeLineArray(lineCount, lineData); } @@ -2344,12 +2344,12 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code, BPrivate::LinkReceiver &li link.ReadString(&string); - fCurrentLayer->ConvertToScreenForDrawing(&location); + fCurrentView->ConvertToScreenForDrawing(&location); BPoint penLocation = drawingEngine->DrawString(string, length, location, delta); - fCurrentLayer->ConvertFromScreenForDrawing(&penLocation); - fCurrentLayer->CurrentState()->SetPenLocation(penLocation); + fCurrentView->ConvertFromScreenForDrawing(&penLocation); + fCurrentView->CurrentState()->SetPenLocation(penLocation); free(string); break; @@ -2364,8 +2364,8 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code, BPrivate::LinkReceiver &li ServerPicture *picture = App()->FindPicture(token); if (picture != NULL) { - fCurrentLayer->CurrentState()->SetOrigin(where); - picture->Play(fCurrentLayer); + fCurrentView->CurrentState()->SetOrigin(where); + picture->Play(fCurrentView); } } break; @@ -2392,7 +2392,7 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code, BPrivate::LinkReceiver &li bool ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver &link) { - ServerPicture *picture = fCurrentLayer->Picture(); + ServerPicture *picture = fCurrentView->Picture(); if (picture == NULL) return false; @@ -2692,7 +2692,7 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver &link) // This might seem a bit weird, but under R5, the shapes // are always offset by the current pen location - BPoint penLocation = fCurrentLayer->CurrentState()->PenLocation(); + BPoint penLocation = fCurrentView->CurrentState()->PenLocation(); for (int32 i = 0; i < ptCount; i++) { ptList[i] += penLocation; } @@ -2775,8 +2775,8 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver &link) { ServerPicture *newPicture = App()->CreatePicture(); newPicture->Usurp(picture); - newPicture->SyncState(fCurrentLayer); - fCurrentLayer->SetPicture(newPicture); + newPicture->SyncState(fCurrentView); + fCurrentView->SetPicture(newPicture); break; } @@ -2787,10 +2787,10 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver &link) link.Read(&pictureToken); ServerPicture *appendPicture = App()->FindPicture(pictureToken); if (appendPicture) { - //picture->SyncState(fCurrentLayer); + //picture->SyncState(fCurrentView); appendPicture->Usurp(picture); } - fCurrentLayer->SetPicture(appendPicture); + fCurrentView->SetPicture(appendPicture); // we don't care if it's NULL break; } @@ -2798,7 +2798,7 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver &link) case AS_LAYER_END_PICTURE: { ServerPicture *steppedDown = picture->StepDown(); - fCurrentLayer->SetPicture(steppedDown); + fCurrentView->SetPicture(steppedDown); fLink.StartMessage(B_OK); fLink.Attach(picture->Token()); fLink.Flush(); @@ -2890,7 +2890,7 @@ ServerWindow::_MessageLooper() quitLoop = true; // ServerWindow's destructor takes care of pulling this object off the desktop. - if (!fWindowLayer->IsHidden()) + if (!fWindow->IsHidden()) CRITICAL("ServerWindow: a window must be hidden before it's deleted\n"); break; @@ -2917,7 +2917,7 @@ ServerWindow::_MessageLooper() #ifdef PROFILE_MESSAGE_LOOP bigtime_t redrawStart = system_time(); #endif - fWindowLayer->RedrawDirtyRegion(); + fWindow->RedrawDirtyRegion(); #ifdef PROFILE_MESSAGE_LOOP diff = system_time() - redrawStart; atomic_add(&sRedrawProcessingTime.count, 1); @@ -2995,13 +2995,13 @@ ServerWindow::SendMessageToClient(const BMessage* msg, int32 target) const } -WindowLayer* -ServerWindow::MakeWindowLayer(BRect frame, const char* name, +Window* +ServerWindow::MakeWindow(BRect frame, const char* name, window_look look, window_feel feel, uint32 flags, uint32 workspace) { - // The non-offscreen ServerWindow uses the DrawingEngine instance from the desktop. - return new (nothrow) WindowLayer(frame, name, look, feel, flags, -// workspace, this, fDesktop->GetDrawingEngine()); + // The non-offscreen ServerWindow uses the DrawingEngine instance from + // the desktop. + return new (nothrow) ::Window(frame, name, look, feel, flags, workspace, this, new DrawingEngine(fDesktop->HWInterface())); } @@ -3091,14 +3091,14 @@ ServerWindow::HandleDirectConnection(int32 bufferState, int32 driverState) fDirectWindowData->buffer_info->pixel_format = buffer->ColorSpace(); fDirectWindowData->buffer_info->layout = B_BUFFER_NONINTERLEAVED; fDirectWindowData->buffer_info->orientation = B_BUFFER_TOP_TO_BOTTOM; // TODO - fDirectWindowData->buffer_info->window_bounds = to_clipping_rect(fWindowLayer->Frame()); + fDirectWindowData->buffer_info->window_bounds = to_clipping_rect(fWindow->Frame()); // TODO: Review this const int32 kMaxClipRectsCount = (B_PAGE_SIZE - sizeof(direct_buffer_info)) / sizeof(clipping_rect); // We just want the region inside the window, border excluded. - BRegion clipRegion = fWindowLayer->VisibleContentRegion(); + BRegion clipRegion = fWindow->VisibleContentRegion(); fDirectWindowData->buffer_info->clip_list_count = min_c(clipRegion.CountRects(), kMaxClipRectsCount); @@ -3132,30 +3132,30 @@ ServerWindow::HandleDirectConnection(int32 bufferState, int32 driverState) void -ServerWindow::_SetCurrentLayer(ViewLayer* layer) +ServerWindow::_SetCurrentView(View* layer) { - if (fCurrentLayer == layer) + if (fCurrentView == layer) return; - fCurrentLayer = layer; + fCurrentView = layer; fCurrentDrawingRegionValid = false; - _UpdateDrawState(fCurrentLayer); + _UpdateDrawState(fCurrentView); #if 0 #if DELAYED_BACKGROUND_CLEARING - if (fCurrentLayer && fCurrentLayer->IsBackgroundDirty() - && fWindowLayer->InUpdate()) { - DrawingEngine* drawingEngine = fWindowLayer->GetDrawingEngine(); + if (fCurrentView && fCurrentView->IsBackgroundDirty() + && fWindow->InUpdate()) { + DrawingEngine* drawingEngine = fWindow->GetDrawingEngine(); if (drawingEngine->LockParallelAccess()) { - fWindowLayer->GetEffectiveDrawingRegion(fCurrentLayer, fCurrentDrawingRegion); + fWindow->GetEffectiveDrawingRegion(fCurrentView, fCurrentDrawingRegion); fCurrentDrawingRegionValid = true; BRegion dirty(fCurrentDrawingRegion); BRegion content; - fWindowLayer->GetContentRegion(&content); + fWindow->GetContentRegion(&content); - fCurrentLayer->Draw(drawingEngine, &dirty, &content, false); + fCurrentView->Draw(drawingEngine, &dirty, &content, false); drawingEngine->UnlockParallelAccess(); } @@ -3166,13 +3166,13 @@ ServerWindow::_SetCurrentLayer(ViewLayer* layer) void -ServerWindow::_UpdateDrawState(ViewLayer* layer) +ServerWindow::_UpdateDrawState(View* layer) { // switch the drawing state // TODO: is it possible to scroll a view while it // is being drawn? probably not... otherwise the // "offsets" passed below would need to be updated again - DrawingEngine* drawingEngine = fWindowLayer->GetDrawingEngine(); + DrawingEngine* drawingEngine = fWindow->GetDrawingEngine(); if (layer && drawingEngine) { BPoint p(0, 0); layer->ConvertToScreenForDrawing(&p); diff --git a/src/servers/app/ServerWindow.h b/src/servers/app/ServerWindow.h index 3cedb2ae7d..e54b70e495 100644 --- a/src/servers/app/ServerWindow.h +++ b/src/servers/app/ServerWindow.h @@ -1,5 +1,5 @@ /* - * Copyright 2001-2006, Haiku. + * Copyright 2001-2008, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -36,9 +36,9 @@ class BMessage; class Desktop; class ServerApp; class Decorator; -class WindowLayer; +class Window; class Workspace; -class ViewLayer; +class View; class ServerPicture; struct direct_window_data; struct window_info; @@ -70,20 +70,22 @@ public: void NotifyZoom(); // util methods. - const BMessenger& FocusMessenger() const { return fFocusMessenger; } - const BMessenger& HandlerMessenger() const { return fHandlerMessenger; } + const BMessenger& FocusMessenger() const + { return fFocusMessenger; } + const BMessenger& HandlerMessenger() const + { return fHandlerMessenger; } status_t SendMessageToClient(const BMessage* msg, int32 target = B_NULL_TOKEN) const; - virtual WindowLayer* MakeWindowLayer(BRect frame, const char* name, - window_look look, window_feel feel, uint32 flags, - uint32 workspace); + virtual ::Window* MakeWindow(BRect frame, const char* name, + window_look look, window_feel feel, + uint32 flags, uint32 workspace); // to who we belong. who do we own. our title. inline ServerApp* App() const { return fServerApp; } ::Desktop* Desktop() const { return fDesktop; } - ::WindowLayer* Window() const; + ::Window* Window() const; void SetTitle(const char* newTitle); inline const char* Title() const { return fTitle; } @@ -104,8 +106,8 @@ public: void ResyncDrawState(); private: - ViewLayer* _CreateLayerTree(BPrivate::LinkReceiver &link, - ViewLayer **_parent); + View* _CreateView(BPrivate::LinkReceiver &link, + View **_parent); void _Show(); void _Hide(); @@ -124,23 +126,22 @@ private: status_t _EnableDirectWindowMode(); - void _SetCurrentLayer(ViewLayer* view); - void _UpdateDrawState(ViewLayer* view); + void _SetCurrentView(View* view); + void _UpdateDrawState(View* view); bool _MessageNeedsAllWindowsLocked(uint32 code) const; // TODO: Move me elsewhere status_t PictureToRegion(ServerPicture *picture, - BRegion &, - bool inverse, - BPoint where); + BRegion& region, bool inverse, + BPoint where); private: char* fTitle; ::Desktop* fDesktop; ServerApp* fServerApp; - WindowLayer* fWindowLayer; + ::Window* fWindow; bool fWindowAddedToDesktop; team_id fClientTeam; @@ -157,7 +158,7 @@ private: int32 fServerToken; int32 fClientToken; - ViewLayer* fCurrentLayer; + View* fCurrentView; BRegion fCurrentDrawingRegion; bool fCurrentDrawingRegionValid; diff --git a/src/servers/app/ViewLayer.cpp b/src/servers/app/View.cpp similarity index 85% rename from src/servers/app/ViewLayer.cpp rename to src/servers/app/View.cpp index 3562c2a4df..1a9624771c 100644 --- a/src/servers/app/ViewLayer.cpp +++ b/src/servers/app/View.cpp @@ -11,7 +11,7 @@ */ -#include "ViewLayer.h" +#include "View.h" #include "BitmapManager.h" #include "Desktop.h" @@ -22,7 +22,7 @@ #include "ServerCursor.h" #include "ServerPicture.h" #include "ServerWindow.h" -#include "WindowLayer.h" +#include "Window.h" #include "drawing_support.h" @@ -71,7 +71,7 @@ resize_frame(IntRect& frame, uint32 resizingMode, int32 x, int32 y) // #pragma mark - -ViewLayer::ViewLayer(IntRect frame, IntPoint scrollingOffset, const char* name, +View::View(IntRect frame, IntPoint scrollingOffset, const char* name, int32 token, uint32 resizeMode, uint32 flags) : fName(name), @@ -116,7 +116,7 @@ ViewLayer::ViewLayer(IntRect frame, IntPoint scrollingOffset, const char* name, } -ViewLayer::~ViewLayer() +View::~View() { if (fViewBitmap != NULL) gBitmapManager->DeleteBitmap(fViewBitmap); @@ -130,9 +130,9 @@ ViewLayer::~ViewLayer() fCursor->Release(); // iterate over children and delete each one - ViewLayer* layer = fFirstChild; + View* layer = fFirstChild; while (layer) { - ViewLayer* toast = layer; + View* toast = layer; layer = layer->fNextSibling; delete toast; } @@ -140,7 +140,7 @@ ViewLayer::~ViewLayer() IntRect -ViewLayer::Bounds() const +View::Bounds() const { IntRect bounds(fScrollingOffset.x, fScrollingOffset.y, fScrollingOffset.x + fFrame.Width(), @@ -150,7 +150,7 @@ ViewLayer::Bounds() const void -ViewLayer::ConvertToVisibleInTopView(IntRect* bounds) const +View::ConvertToVisibleInTopView(IntRect* bounds) const { *bounds = *bounds & Bounds(); // NOTE: this step is necessary even if we don't have a parent! @@ -162,7 +162,7 @@ ViewLayer::ConvertToVisibleInTopView(IntRect* bounds) const void -ViewLayer::AttachedToWindow(WindowLayer* window) +View::AttachedToWindow(::Window* window) { fWindow = window; @@ -177,13 +177,13 @@ ViewLayer::AttachedToWindow(WindowLayer* window) } // attach child views as well - for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) + for (View* child = FirstChild(); child; child = child->NextSibling()) child->AttachedToWindow(window); } void -ViewLayer::DetachedFromWindow() +View::DetachedFromWindow() { // remove view from local token space if (fWindow != NULL) @@ -191,7 +191,7 @@ ViewLayer::DetachedFromWindow() fWindow = NULL; // detach child views as well - for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) + for (View* child = FirstChild(); child; child = child->NextSibling()) child->DetachedFromWindow(); } @@ -200,10 +200,10 @@ ViewLayer::DetachedFromWindow() void -ViewLayer::AddChild(ViewLayer* layer) +View::AddChild(View* layer) { if (layer->fParent) { - printf("ViewLayer::AddChild() - ViewLayer already has a parent\n"); + printf("View::AddChild() - View already has a parent\n"); return; } @@ -243,10 +243,10 @@ ViewLayer::AddChild(ViewLayer* layer) bool -ViewLayer::RemoveChild(ViewLayer* layer) +View::RemoveChild(View* layer) { if (layer->fParent != this) { - printf("ViewLayer::RemoveChild(%p - %s) - ViewLayer is not child of " + printf("View::RemoveChild(%p - %s) - View is not child of " "this (%p) layer!\n", layer, layer ? layer->Name() : NULL, this); return false; } @@ -300,8 +300,8 @@ ViewLayer::RemoveChild(ViewLayer* layer) } -ViewLayer* -ViewLayer::TopLayer() +View* +View::TopLayer() { // returns the top level view of the hirarchy, // it doesn't have to be the top level of a window @@ -314,10 +314,10 @@ ViewLayer::TopLayer() uint32 -ViewLayer::CountChildren(bool deep) const +View::CountChildren(bool deep) const { uint32 count = 0; - for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) { + for (View* child = FirstChild(); child; child = child->NextSibling()) { count++; if (deep) { count += child->CountChildren(deep); @@ -328,9 +328,9 @@ ViewLayer::CountChildren(bool deep) const void -ViewLayer::CollectTokensForChildren(BList* tokenMap) const +View::CollectTokensForChildren(BList* tokenMap) const { - for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) { + for (View* child = FirstChild(); child; child = child->NextSibling()) { tokenMap->AddItem((void*)child); child->CollectTokensForChildren(tokenMap); } @@ -339,7 +339,7 @@ ViewLayer::CollectTokensForChildren(BList* tokenMap) const #if 0 bool -ViewLayer::MarkAt(DrawingEngine* engine, const BPoint& where, int32 level) +View::MarkAt(DrawingEngine* engine, const BPoint& where, int32 level) { BRect rect(fFrame.left, fFrame.top, fFrame.right, fFrame.bottom); @@ -353,7 +353,7 @@ ViewLayer::MarkAt(DrawingEngine* engine, const BPoint& where, int32 level) bool found = false; - for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) { + for (View* child = FirstChild(); child; child = child->NextSibling()) { found |= child->MarkAt(engine, where, level + 1); } @@ -377,7 +377,7 @@ ViewLayer::MarkAt(DrawingEngine* engine, const BPoint& where, int32 level) void -ViewLayer::FindViews(uint32 flags, BObjectList& list, int32& left) +View::FindViews(uint32 flags, BObjectList& list, int32& left) { if ((Flags() & flags) == flags) { list.AddItem(this); @@ -385,7 +385,7 @@ ViewLayer::FindViews(uint32 flags, BObjectList& list, int32& left) return; } - for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) { + for (View* child = FirstChild(); child; child = child->NextSibling()) { child->FindViews(flags, list, left); if (left == 0) break; @@ -393,8 +393,8 @@ ViewLayer::FindViews(uint32 flags, BObjectList& list, int32& left) } -ViewLayer* -ViewLayer::ViewAt(const BPoint& where) +View* +View::ViewAt(const BPoint& where) { if (!fVisible) return NULL; @@ -406,8 +406,8 @@ ViewLayer::ViewAt(const BPoint& where) if (!frame.Contains(where)) return NULL; - for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) { - ViewLayer* layer = child->ViewAt(where); + for (View* child = FirstChild(); child; child = child->NextSibling()) { + View* layer = child->ViewAt(where); if (layer != NULL) return layer; } @@ -420,14 +420,14 @@ ViewLayer::ViewAt(const BPoint& where) void -ViewLayer::SetName(const char* string) +View::SetName(const char* string) { fName.SetTo(string); } void -ViewLayer::SetFlags(uint32 flags) +View::SetFlags(uint32 flags) { fFlags = flags; fDrawState->SetSubPixelPrecise(fFlags & B_SUBPIXEL_PRECISE); @@ -435,7 +435,7 @@ ViewLayer::SetFlags(uint32 flags) void -ViewLayer::SetDrawingOrigin(BPoint origin) +View::SetDrawingOrigin(BPoint origin) { fDrawState->SetOrigin(origin); @@ -446,7 +446,7 @@ ViewLayer::SetDrawingOrigin(BPoint origin) BPoint -ViewLayer::DrawingOrigin() const +View::DrawingOrigin() const { BPoint origin(fDrawState->Origin()); float scale = Scale(); @@ -459,7 +459,7 @@ ViewLayer::DrawingOrigin() const void -ViewLayer::SetScale(float scale) +View::SetScale(float scale) { fDrawState->SetScale(scale); @@ -470,14 +470,14 @@ ViewLayer::SetScale(float scale) float -ViewLayer::Scale() const +View::Scale() const { return CurrentState()->Scale(); } void -ViewLayer::SetUserClipping(const BRegion* region) +View::SetUserClipping(const BRegion* region) { fDrawState->SetClippingRegion(region); @@ -487,7 +487,7 @@ ViewLayer::SetUserClipping(const BRegion* region) void -ViewLayer::SetViewBitmap(ServerBitmap* bitmap, IntRect sourceRect, +View::SetViewBitmap(ServerBitmap* bitmap, IntRect sourceRect, IntRect destRect, int32 resizingMode, int32 options) { if (fViewBitmap != NULL) { @@ -520,7 +520,7 @@ ViewLayer::SetViewBitmap(ServerBitmap* bitmap, IntRect sourceRect, ::Overlay* -ViewLayer::_Overlay() const +View::_Overlay() const { if (fViewBitmap == NULL) return NULL; @@ -530,7 +530,7 @@ ViewLayer::_Overlay() const void -ViewLayer::_UpdateOverlayView() const +View::_UpdateOverlayView() const { Overlay* overlay = _Overlay(); if (overlay == NULL) @@ -548,7 +548,7 @@ ViewLayer::_UpdateOverlayView() const be nice to have a better solution for this, though. */ void -ViewLayer::UpdateOverlay() +View::UpdateOverlay() { if (!IsVisible()) return; @@ -558,7 +558,7 @@ ViewLayer::UpdateOverlay() } else { // recursively ask children of this view - for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) { + for (View* child = FirstChild(); child; child = child->NextSibling()) { child->UpdateOverlay(); } } @@ -569,7 +569,7 @@ ViewLayer::UpdateOverlay() void -ViewLayer::ConvertToParent(BPoint* point) const +View::ConvertToParent(BPoint* point) const { // remove scrolling offset and convert to parent coordinate space point->x += fFrame.left - fScrollingOffset.x; @@ -578,7 +578,7 @@ ViewLayer::ConvertToParent(BPoint* point) const void -ViewLayer::ConvertToParent(IntPoint* point) const +View::ConvertToParent(IntPoint* point) const { // remove scrolling offset and convert to parent coordinate space point->x += fFrame.left - fScrollingOffset.x; @@ -587,7 +587,7 @@ ViewLayer::ConvertToParent(IntPoint* point) const void -ViewLayer::ConvertToParent(BRect* rect) const +View::ConvertToParent(BRect* rect) const { // remove scrolling offset and convert to parent coordinate space rect->OffsetBy(fFrame.left - fScrollingOffset.x, @@ -596,7 +596,7 @@ ViewLayer::ConvertToParent(BRect* rect) const void -ViewLayer::ConvertToParent(IntRect* rect) const +View::ConvertToParent(IntRect* rect) const { // remove scrolling offset and convert to parent coordinate space rect->OffsetBy(fFrame.left - fScrollingOffset.x, @@ -605,7 +605,7 @@ ViewLayer::ConvertToParent(IntRect* rect) const void -ViewLayer::ConvertToParent(BRegion* region) const +View::ConvertToParent(BRegion* region) const { // remove scrolling offset and convert to parent coordinate space region->OffsetBy(fFrame.left - fScrollingOffset.x, @@ -614,7 +614,7 @@ ViewLayer::ConvertToParent(BRegion* region) const void -ViewLayer::ConvertFromParent(BPoint* point) const +View::ConvertFromParent(BPoint* point) const { // convert from parent coordinate space amd add scrolling offset point->x += fScrollingOffset.x - fFrame.left; @@ -623,7 +623,7 @@ ViewLayer::ConvertFromParent(BPoint* point) const void -ViewLayer::ConvertFromParent(IntPoint* point) const +View::ConvertFromParent(IntPoint* point) const { // convert from parent coordinate space amd add scrolling offset point->x += fScrollingOffset.x - fFrame.left; @@ -632,7 +632,7 @@ ViewLayer::ConvertFromParent(IntPoint* point) const void -ViewLayer::ConvertFromParent(BRect* rect) const +View::ConvertFromParent(BRect* rect) const { // convert from parent coordinate space amd add scrolling offset rect->OffsetBy(fScrollingOffset.x - fFrame.left, @@ -641,7 +641,7 @@ ViewLayer::ConvertFromParent(BRect* rect) const void -ViewLayer::ConvertFromParent(IntRect* rect) const +View::ConvertFromParent(IntRect* rect) const { // convert from parent coordinate space amd add scrolling offset rect->OffsetBy(fScrollingOffset.x - fFrame.left, @@ -650,7 +650,7 @@ ViewLayer::ConvertFromParent(IntRect* rect) const void -ViewLayer::ConvertFromParent(BRegion* region) const +View::ConvertFromParent(BRegion* region) const { // convert from parent coordinate space amd add scrolling offset region->OffsetBy(fScrollingOffset.x - fFrame.left, @@ -659,7 +659,7 @@ ViewLayer::ConvertFromParent(BRegion* region) const //! converts a point from local to screen coordinate system void -ViewLayer::ConvertToScreen(BPoint* pt) const +View::ConvertToScreen(BPoint* pt) const { ConvertToParent(pt); @@ -670,7 +670,7 @@ ViewLayer::ConvertToScreen(BPoint* pt) const //! converts a point from local to screen coordinate system void -ViewLayer::ConvertToScreen(IntPoint* pt) const +View::ConvertToScreen(IntPoint* pt) const { ConvertToParent(pt); @@ -681,7 +681,7 @@ ViewLayer::ConvertToScreen(IntPoint* pt) const //! converts a rect from local to screen coordinate system void -ViewLayer::ConvertToScreen(BRect* rect) const +View::ConvertToScreen(BRect* rect) const { BPoint offset(0.0, 0.0); ConvertToScreen(&offset); @@ -692,7 +692,7 @@ ViewLayer::ConvertToScreen(BRect* rect) const //! converts a rect from local to screen coordinate system void -ViewLayer::ConvertToScreen(IntRect* rect) const +View::ConvertToScreen(IntRect* rect) const { BPoint offset(0.0, 0.0); ConvertToScreen(&offset); @@ -703,7 +703,7 @@ ViewLayer::ConvertToScreen(IntRect* rect) const //! converts a region from local to screen coordinate system void -ViewLayer::ConvertToScreen(BRegion* region) const +View::ConvertToScreen(BRegion* region) const { BPoint offset(0.0, 0.0); ConvertToScreen(&offset); @@ -714,7 +714,7 @@ ViewLayer::ConvertToScreen(BRegion* region) const //! converts a point from screen to local coordinate system void -ViewLayer::ConvertFromScreen(BPoint* pt) const +View::ConvertFromScreen(BPoint* pt) const { ConvertFromParent(pt); @@ -725,7 +725,7 @@ ViewLayer::ConvertFromScreen(BPoint* pt) const //! converts a point from screen to local coordinate system void -ViewLayer::ConvertFromScreen(IntPoint* pt) const +View::ConvertFromScreen(IntPoint* pt) const { ConvertFromParent(pt); @@ -736,7 +736,7 @@ ViewLayer::ConvertFromScreen(IntPoint* pt) const //! converts a rect from screen to local coordinate system void -ViewLayer::ConvertFromScreen(BRect* rect) const +View::ConvertFromScreen(BRect* rect) const { BPoint offset(0.0, 0.0); ConvertFromScreen(&offset); @@ -747,7 +747,7 @@ ViewLayer::ConvertFromScreen(BRect* rect) const //! converts a rect from screen to local coordinate system void -ViewLayer::ConvertFromScreen(IntRect* rect) const +View::ConvertFromScreen(IntRect* rect) const { BPoint offset(0.0, 0.0); ConvertFromScreen(&offset); @@ -758,7 +758,7 @@ ViewLayer::ConvertFromScreen(IntRect* rect) const //! converts a region from screen to local coordinate system void -ViewLayer::ConvertFromScreen(BRegion* region) const +View::ConvertFromScreen(BRegion* region) const { BPoint offset(0.0, 0.0); ConvertFromScreen(&offset); @@ -769,7 +769,7 @@ ViewLayer::ConvertFromScreen(BRegion* region) const //! converts a point from local *drawing* to screen coordinate system void -ViewLayer::ConvertToScreenForDrawing(BPoint* point) const +View::ConvertToScreenForDrawing(BPoint* point) const { fDrawState->Transform(point); // NOTE: from here on, don't use the @@ -780,7 +780,7 @@ ViewLayer::ConvertToScreenForDrawing(BPoint* point) const //! converts a rect from local *drawing* to screen coordinate system void -ViewLayer::ConvertToScreenForDrawing(BRect* rect) const +View::ConvertToScreenForDrawing(BRect* rect) const { fDrawState->Transform(rect); // NOTE: from here on, don't use the @@ -791,7 +791,7 @@ ViewLayer::ConvertToScreenForDrawing(BRect* rect) const //! converts a region from local *drawing* to screen coordinate system void -ViewLayer::ConvertToScreenForDrawing(BRegion* region) const +View::ConvertToScreenForDrawing(BRegion* region) const { fDrawState->Transform(region); // NOTE: from here on, don't use the @@ -802,7 +802,7 @@ ViewLayer::ConvertToScreenForDrawing(BRegion* region) const //! converts points from local *drawing* to screen coordinate system void -ViewLayer::ConvertToScreenForDrawing(BPoint* dst, const BPoint* src, int32 num) const +View::ConvertToScreenForDrawing(BPoint* dst, const BPoint* src, int32 num) const { // TODO: optimize this, it should be smarter while (num--) { @@ -819,7 +819,7 @@ ViewLayer::ConvertToScreenForDrawing(BPoint* dst, const BPoint* src, int32 num) //! converts rects from local *drawing* to screen coordinate system void -ViewLayer::ConvertToScreenForDrawing(BRect* dst, const BRect* src, int32 num) const +View::ConvertToScreenForDrawing(BRect* dst, const BRect* src, int32 num) const { // TODO: optimize this, it should be smarter while (num--) { @@ -836,7 +836,7 @@ ViewLayer::ConvertToScreenForDrawing(BRect* dst, const BRect* src, int32 num) co //! converts regions from local *drawing* to screen coordinate system void -ViewLayer::ConvertToScreenForDrawing(BRegion* dst, const BRegion* src, int32 num) const +View::ConvertToScreenForDrawing(BRegion* dst, const BRegion* src, int32 num) const { // TODO: optimize this, it should be smarter while (num--) { @@ -853,7 +853,7 @@ ViewLayer::ConvertToScreenForDrawing(BRegion* dst, const BRegion* src, int32 num //! converts a point from screen to local coordinate system void -ViewLayer::ConvertFromScreenForDrawing(BPoint* point) const +View::ConvertFromScreenForDrawing(BPoint* point) const { ConvertFromScreen(point); fDrawState->InverseTransform(point); @@ -864,7 +864,7 @@ ViewLayer::ConvertFromScreenForDrawing(BPoint* point) const void -ViewLayer::MoveBy(int32 x, int32 y, BRegion* dirtyRegion) +View::MoveBy(int32 x, int32 y, BRegion* dirtyRegion) { if (x == 0 && y == 0) return; @@ -937,7 +937,7 @@ ViewLayer::MoveBy(int32 x, int32 y, BRegion* dirtyRegion) void -ViewLayer::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion) +View::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion) { if (x == 0 && y == 0) return; @@ -969,7 +969,7 @@ ViewLayer::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion) if ((fFlags & B_DRAW_ON_CHILDREN) == 0) { // exclude children, they are expected to // include their own dirty regions in ParentResized() - for (ViewLayer* child = FirstChild(); child; + for (View* child = FirstChild(); child; child = child->NextSibling()) { if (!child->IsVisible()) continue; @@ -988,7 +988,7 @@ ViewLayer::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion) } // layout the children - for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) + for (View* child = FirstChild(); child; child = child->NextSibling()) child->ParentResized(x, y, dirtyRegion); // view bitmap @@ -1004,7 +1004,7 @@ ViewLayer::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion) void -ViewLayer::ParentResized(int32 x, int32 y, BRegion* dirtyRegion) +View::ParentResized(int32 x, int32 y, BRegion* dirtyRegion) { IntRect newFrame = fFrame; resize_frame(newFrame, fResizeMode & 0x0000ffff, x, y); @@ -1029,7 +1029,7 @@ ViewLayer::ParentResized(int32 x, int32 y, BRegion* dirtyRegion) void -ViewLayer::ScrollBy(int32 x, int32 y, BRegion* dirtyRegion) +View::ScrollBy(int32 x, int32 y, BRegion* dirtyRegion) { if (!fVisible || !fWindow) { fScrollingOffset.x += x; @@ -1087,7 +1087,7 @@ ViewLayer::ScrollBy(int32 x, int32 y, BRegion* dirtyRegion) void -ViewLayer::CopyBits(IntRect src, IntRect dst, BRegion& windowContentClipping) +View::CopyBits(IntRect src, IntRect dst, BRegion& windowContentClipping) { if (!fVisible || !fWindow) return; @@ -1167,7 +1167,7 @@ ViewLayer::CopyBits(IntRect src, IntRect dst, BRegion& windowContentClipping) void -ViewLayer::PushState() +View::PushState() { fDrawState = fDrawState->PushState(); fDrawState->SetSubPixelPrecise(fFlags & B_SUBPIXEL_PRECISE); @@ -1175,7 +1175,7 @@ ViewLayer::PushState() void -ViewLayer::PopState() +View::PopState() { if (fDrawState->PreviousState() == NULL) { fprintf(stderr, "WARNING: User called BView(%s)::PopState(), " @@ -1196,7 +1196,7 @@ ViewLayer::PopState() void -ViewLayer::SetEventMask(uint32 eventMask, uint32 options) +View::SetEventMask(uint32 eventMask, uint32 options) { fEventMask = eventMask; fEventOptions = options; @@ -1204,7 +1204,7 @@ ViewLayer::SetEventMask(uint32 eventMask, uint32 options) void -ViewLayer::SetCursor(ServerCursor *cursor) +View::SetCursor(ServerCursor *cursor) { if (cursor == fCursor) return; @@ -1222,14 +1222,14 @@ ViewLayer::SetCursor(ServerCursor *cursor) void -ViewLayer::SetPicture(ServerPicture *picture) +View::SetPicture(ServerPicture *picture) { fPicture = picture; } void -ViewLayer::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping, +View::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping, BRegion* windowContentClipping, bool deep) { if (!fVisible) { @@ -1266,7 +1266,7 @@ ViewLayer::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping, rect.OffsetBy(-(rect.Width() + 1), 0.0); } -// XXX: locking removed because the WindowLayer keeps the engine locked +// XXX: locking removed because the Window keeps the engine locked // because it keeps track of syncing right now // lock the drawing engine for as long as we need the clipping @@ -1357,7 +1357,7 @@ ViewLayer::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping, // let children draw if (deep) { - for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) { + for (View* child = FirstChild(); child; child = child->NextSibling()) { child->Draw(drawingEngine, effectiveClipping, windowContentClipping, deep); } @@ -1369,21 +1369,21 @@ ViewLayer::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping, void -ViewLayer::MouseDown(BMessage* message, BPoint where) +View::MouseDown(BMessage* message, BPoint where) { // empty hook method } void -ViewLayer::MouseUp(BMessage* message, BPoint where) +View::MouseUp(BMessage* message, BPoint where) { // empty hook method } void -ViewLayer::MouseMoved(BMessage* message, BPoint where) +View::MouseMoved(BMessage* message, BPoint where) { // empty hook method } @@ -1393,7 +1393,7 @@ ViewLayer::MouseMoved(BMessage* message, BPoint where) void -ViewLayer::SetHidden(bool hidden) +View::SetHidden(bool hidden) { if (fHidden != hidden) { fHidden = hidden; @@ -1426,19 +1426,19 @@ ViewLayer::SetHidden(bool hidden) bool -ViewLayer::IsHidden() const +View::IsHidden() const { return fHidden; } void -ViewLayer::UpdateVisibleDeep(bool parentVisible) +View::UpdateVisibleDeep(bool parentVisible) { bool wasVisible = fVisible; fVisible = parentVisible && !fHidden; - for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) + for (View* child = FirstChild(); child; child = child->NextSibling()) child->UpdateVisibleDeep(fVisible); // overlay handling @@ -1458,18 +1458,18 @@ ViewLayer::UpdateVisibleDeep(bool parentVisible) void -ViewLayer::MarkBackgroundDirty() +View::MarkBackgroundDirty() { if (fBackgroundDirty) return; fBackgroundDirty = true; - for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) + for (View* child = FirstChild(); child; child = child->NextSibling()) child->MarkBackgroundDirty(); } void -ViewLayer::AddTokensForLayersInRegion(BMessage* message, BRegion& region, +View::AddTokensForLayersInRegion(BMessage* message, BRegion& region, BRegion* windowContentClipping) { if (!fVisible) @@ -1478,7 +1478,7 @@ ViewLayer::AddTokensForLayersInRegion(BMessage* message, BRegion& region, if (region.Intersects(ScreenClipping(windowContentClipping).Frame())) message->AddInt32("_token", fToken); - for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) { + for (View* child = FirstChild(); child; child = child->NextSibling()) { child->AddTokensForLayersInRegion(message, region, windowContentClipping); } @@ -1486,7 +1486,7 @@ ViewLayer::AddTokensForLayersInRegion(BMessage* message, BRegion& region, void -ViewLayer::AddTokensForLayersInRegion(BPrivate::PortLink& link, BRegion& region, +View::AddTokensForLayersInRegion(BPrivate::PortLink& link, BRegion& region, BRegion* windowContentClipping) { if (!fVisible) @@ -1500,16 +1500,16 @@ ViewLayer::AddTokensForLayersInRegion(BPrivate::PortLink& link, BRegion& region, if (region.Intersects(ScreenClipping(windowContentClipping).Frame())) link.Attach(fToken); - for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) { + for (View* child = FirstChild(); child; child = child->NextSibling()) { child->AddTokensForLayersInRegion(link, region, windowContentClipping); } } void -ViewLayer::PrintToStream() const +View::PrintToStream() const { - printf("ViewLayer: %s\n", Name()); + printf("View: %s\n", Name()); printf(" fToken: %ld\n", fToken); printf(" fFrame: IntRect(%ld, %ld, %ld, %ld)\n", fFrame.left, fFrame.top, fFrame.right, fFrame.bottom); printf(" fScrollingOffset: IntPoint(%ld, %ld)\n", fScrollingOffset.x, fScrollingOffset.y); @@ -1531,12 +1531,12 @@ ViewLayer::PrintToStream() const void -ViewLayer::RebuildClipping(bool deep) +View::RebuildClipping(bool deep) { // the clipping spans over the bounds area fLocalClipping.Set((clipping_rect)Bounds()); - if (ViewLayer* child = FirstChild()) { + if (View* child = FirstChild()) { // if this view does not draw over children, // exclude all children from the clipping if ((fFlags & B_DRAW_ON_CHILDREN) == 0) { @@ -1581,7 +1581,7 @@ ViewLayer::RebuildClipping(bool deep) BRegion& -ViewLayer::ScreenClipping(BRegion* windowContentClipping, bool force) const +View::ScreenClipping(BRegion* windowContentClipping, bool force) const { if (!fScreenClippingValid || force) { fScreenClipping = fLocalClipping; @@ -1604,14 +1604,14 @@ ViewLayer::ScreenClipping(BRegion* windowContentClipping, bool force) const fScreenClipping.IntersectWith(windowContentClipping); fScreenClippingValid = true; } -//printf("###ViewLayer(%s)::ScreenClipping():\n", Name()); +//printf("###View(%s)::ScreenClipping():\n", Name()); //fScreenClipping.PrintToStream(); return fScreenClipping; } void -ViewLayer::InvalidateScreenClipping() +View::InvalidateScreenClipping() { // TODO: appearantly, we are calling ScreenClipping() on // views who's parents don't have a valid screen clipping yet, @@ -1631,21 +1631,21 @@ ViewLayer::InvalidateScreenClipping() fScreenClippingValid = false; // invalidate the childrens screen clipping as well - for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) { + for (View* child = FirstChild(); child; child = child->NextSibling()) { child->InvalidateScreenClipping(); } } void -ViewLayer::_MoveScreenClipping(int32 x, int32 y, bool deep) +View::_MoveScreenClipping(int32 x, int32 y, bool deep) { if (fScreenClippingValid) fScreenClipping.OffsetBy(x, y); if (deep) { // move the childrens screen clipping as well - for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) { + for (View* child = FirstChild(); child; child = child->NextSibling()) { child->_MoveScreenClipping(x, y, deep); } } diff --git a/src/servers/app/ViewLayer.h b/src/servers/app/View.h similarity index 88% rename from src/servers/app/ViewLayer.h rename to src/servers/app/View.h index 86536d5db0..1cf147728f 100644 --- a/src/servers/app/ViewLayer.h +++ b/src/servers/app/View.h @@ -9,8 +9,8 @@ * Stephan Aßmus * Marcus Overhagen */ -#ifndef VIEW_LAYER_H -#define VIEW_LAYER_H +#ifndef VIEW_H +#define VIEW_H #include "IntRect.h" @@ -30,18 +30,17 @@ namespace BPrivate { class DrawState; class DrawingEngine; class Overlay; -class WindowLayer; +class Window; class ServerBitmap; class ServerCursor; class ServerPicture; -class ViewLayer { +class View { public: - ViewLayer(IntRect frame, IntPoint scrollingOffset, + View(IntRect frame, IntPoint scrollingOffset, const char* name, int32 token, uint32 resizeMode, uint32 flags); - - virtual ~ViewLayer(); + virtual ~View(); int32 Token() const { return fToken; } @@ -77,34 +76,34 @@ class ViewLayer { // clips to each views bounds void ConvertToVisibleInTopView(IntRect* bounds) const; - virtual void AttachedToWindow(WindowLayer* window); + virtual void AttachedToWindow(::Window* window); virtual void DetachedFromWindow(); - WindowLayer* Window() const { return fWindow; } + ::Window* Window() const { return fWindow; } // tree stuff - void AddChild(ViewLayer* layer); - bool RemoveChild(ViewLayer* layer); + void AddChild(View* layer); + bool RemoveChild(View* layer); - inline ViewLayer* Parent() const + inline View* Parent() const { return fParent; } - inline ViewLayer* FirstChild() const + inline View* FirstChild() const { return fFirstChild; } - inline ViewLayer* LastChild() const + inline View* LastChild() const { return fLastChild; } - inline ViewLayer* PreviousSibling() const + inline View* PreviousSibling() const { return fPreviousSibling; } - inline ViewLayer* NextSibling() const + inline View* NextSibling() const { return fNextSibling; } - ViewLayer* TopLayer(); + View* TopLayer(); uint32 CountChildren(bool deep = false) const; void CollectTokensForChildren(BList* tokenMap) const; - void FindViews(uint32 flags, - BObjectList& list, int32& left); + void FindViews(uint32 flags, BObjectList& list, + int32& left); - ViewLayer* ViewAt(const BPoint& where); + View* ViewAt(const BPoint& where); // coordinate conversion void ConvertToParent(BPoint* point) const; @@ -155,7 +154,7 @@ class ViewLayer { BRegion* dirtyRegion); void CopyBits(IntRect src, IntRect dst, - BRegion& windowContentClipping); + BRegion& windowContentClipping); const BRegion& LocalClipping() const { return fLocalClipping; } @@ -270,13 +269,13 @@ class ViewLayer { uint32 fEventMask; uint32 fEventOptions; - WindowLayer* fWindow; - ViewLayer* fParent; + ::Window* fWindow; + View* fParent; - ViewLayer* fFirstChild; - ViewLayer* fPreviousSibling; - ViewLayer* fNextSibling; - ViewLayer* fLastChild; + View* fFirstChild; + View* fPreviousSibling; + View* fNextSibling; + View* fLastChild; ServerCursor* fCursor; ServerPicture* fPicture; @@ -286,8 +285,6 @@ class ViewLayer { mutable BRegion fScreenClipping; mutable bool fScreenClippingValid; - }; - -#endif // LAYER_H +#endif // VIEW_H diff --git a/src/servers/app/WindowLayer.cpp b/src/servers/app/Window.cpp similarity index 90% rename from src/servers/app/WindowLayer.cpp rename to src/servers/app/Window.cpp index 215f0b3614..1dccea1bca 100644 --- a/src/servers/app/WindowLayer.cpp +++ b/src/servers/app/Window.cpp @@ -10,7 +10,7 @@ */ -#include "WindowLayer.h" +#include "Window.h" #include "DebugInfoManager.h" #include "Decorator.h" @@ -23,7 +23,7 @@ #include "ServerApp.h" #include "ServerWindow.h" #include "Workspace.h" -#include "WorkspacesLayer.h" +#include "WorkspacesView.h" #include #include @@ -68,7 +68,7 @@ using std::nothrow; // the update session, which tells us the cause of the update -WindowLayer::WindowLayer(const BRect& frame, const char *name, +Window::Window(const BRect& frame, const char *name, window_look look, window_feel feel, uint32 flags, uint32 workspaces, ::ServerWindow* window, DrawingEngine* drawingEngine) : @@ -167,14 +167,14 @@ WindowLayer::WindowLayer(const BRect& frame, const char *name, } } - STRACE(("WindowLayer %p, %s:\n", this, Name())); + STRACE(("Window %p, %s:\n", this, Name())); STRACE(("\tFrame: (%.1f, %.1f, %.1f, %.1f)\n", fFrame.left, fFrame.top, fFrame.right, fFrame.bottom)); STRACE(("\tWindow %s\n", window ? window->Title() : "NULL")); } -WindowLayer::~WindowLayer() +Window::~Window() { if (fTopLayer) fTopLayer->DetachedFromWindow(); @@ -185,7 +185,7 @@ WindowLayer::~WindowLayer() void -WindowLayer::SetClipping(BRegion* stillAvailableOnScreen) +Window::SetClipping(BRegion* stillAvailableOnScreen) { // this function is only called from the Desktop thread @@ -203,7 +203,7 @@ WindowLayer::SetClipping(BRegion* stillAvailableOnScreen) void -WindowLayer::GetFullRegion(BRegion* region) +Window::GetFullRegion(BRegion* region) { // TODO: if someone needs to call this from // the outside, the clipping needs to be readlocked! @@ -215,7 +215,7 @@ WindowLayer::GetFullRegion(BRegion* region) // GetBorderRegion void -WindowLayer::GetBorderRegion(BRegion* region) +Window::GetBorderRegion(BRegion* region) { // TODO: if someone needs to call this from // the outside, the clipping needs to be readlocked! @@ -234,7 +234,7 @@ WindowLayer::GetBorderRegion(BRegion* region) void -WindowLayer::GetContentRegion(BRegion* region) +Window::GetContentRegion(BRegion* region) { // TODO: if someone needs to call this from // the outside, the clipping needs to be readlocked! @@ -248,7 +248,7 @@ WindowLayer::GetContentRegion(BRegion* region) BRegion& -WindowLayer::VisibleContentRegion() +Window::VisibleContentRegion() { // TODO: if someone needs to call this from // the outside, the clipping needs to be readlocked! @@ -266,7 +266,7 @@ WindowLayer::VisibleContentRegion() void -WindowLayer::_PropagatePosition() +Window::_PropagatePosition() { if ((fFlags & B_SAME_POSITION_IN_ALL_WORKSPACES) == 0) return; @@ -278,7 +278,7 @@ WindowLayer::_PropagatePosition() void -WindowLayer::MoveBy(int32 x, int32 y) +Window::MoveBy(int32 x, int32 y) { // this function is only called from the desktop thread @@ -323,7 +323,7 @@ WindowLayer::MoveBy(int32 x, int32 y) void -WindowLayer::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion) +Window::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion) { // this function is only called from the desktop thread @@ -385,7 +385,7 @@ WindowLayer::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion) void -WindowLayer::ScrollViewBy(ViewLayer* view, int32 dx, int32 dy) +Window::ScrollViewBy(View* view, int32 dx, int32 dy) { // this is executed in ServerWindow with the Readlock // held @@ -413,7 +413,7 @@ WindowLayer::ScrollViewBy(ViewLayer* view, int32 dx, int32 dy) //! Takes care of invalidating parts that could not be copied void -WindowLayer::CopyContents(BRegion* region, int32 xOffset, int32 yOffset) +Window::CopyContents(BRegion* region, int32 xOffset, int32 yOffset) { // executed in ServerWindow thread with the read lock held if (!IsVisible()) @@ -485,7 +485,7 @@ WindowLayer::CopyContents(BRegion* region, int32 xOffset, int32 yOffset) void -WindowLayer::SetTopLayer(ViewLayer* topLayer) +Window::SetTopLayer(View* topLayer) { fTopLayer = topLayer; @@ -509,29 +509,29 @@ WindowLayer::SetTopLayer(ViewLayer* topLayer) } -ViewLayer* -WindowLayer::ViewAt(const BPoint& where) +View* +Window::ViewAt(const BPoint& where) { return fTopLayer->ViewAt(where); } window_anchor& -WindowLayer::Anchor(int32 index) +Window::Anchor(int32 index) { return fAnchor[index]; } -WindowLayer* -WindowLayer::NextWindow(int32 index) const +Window* +Window::NextWindow(int32 index) const { return fAnchor[index].next; } -WindowLayer* -WindowLayer::PreviousWindow(int32 index) const +Window* +Window::PreviousWindow(int32 index) const { return fAnchor[index].previous; } @@ -541,7 +541,7 @@ WindowLayer::PreviousWindow(int32 index) const void -WindowLayer::GetEffectiveDrawingRegion(ViewLayer* layer, BRegion& region) +Window::GetEffectiveDrawingRegion(View* layer, BRegion& region) { if (!fEffectiveDrawingRegionValid) { fEffectiveDrawingRegion = VisibleContentRegion(); @@ -554,7 +554,7 @@ WindowLayer::GetEffectiveDrawingRegion(ViewLayer* layer, BRegion& region) fEffectiveDrawingRegion.IntersectWith(&fCurrentUpdateSession->DirtyRegion()); } else { // not in update, the view can draw everywhere -//printf("WindowLayer(%s)::GetEffectiveDrawingRegion(for %s) - outside update\n", Title(), layer->Name()); +//printf("Window(%s)::GetEffectiveDrawingRegion(for %s) - outside update\n", Title(), layer->Name()); } fEffectiveDrawingRegionValid = true; @@ -574,14 +574,14 @@ WindowLayer::GetEffectiveDrawingRegion(ViewLayer* layer, BRegion& region) bool -WindowLayer::DrawingRegionChanged(ViewLayer* layer) const +Window::DrawingRegionChanged(View* layer) const { return !fEffectiveDrawingRegionValid || !layer->IsScreenClippingValid(); } void -WindowLayer::ProcessDirtyRegion(BRegion& region) +Window::ProcessDirtyRegion(BRegion& region) { // if this is exectuted in the desktop thread, // it means that the window thread currently @@ -610,7 +610,7 @@ WindowLayer::ProcessDirtyRegion(BRegion& region) void -WindowLayer::RedrawDirtyRegion() +Window::RedrawDirtyRegion() { // executed from ServerWindow with the read lock held @@ -639,7 +639,7 @@ WindowLayer::RedrawDirtyRegion() void -WindowLayer::MarkDirty(BRegion& regionOnScreen) +Window::MarkDirty(BRegion& regionOnScreen) { // for marking any part of the desktop dirty // this will get write access to the global @@ -651,7 +651,7 @@ WindowLayer::MarkDirty(BRegion& regionOnScreen) void -WindowLayer::MarkContentDirty(BRegion& regionOnScreen) +Window::MarkContentDirty(BRegion& regionOnScreen) { // for triggering AS_REDRAW // since this won't affect other windows, read locking @@ -667,7 +667,7 @@ WindowLayer::MarkContentDirty(BRegion& regionOnScreen) void -WindowLayer::MarkContentDirtyAsync(BRegion& regionOnScreen) +Window::MarkContentDirtyAsync(BRegion& regionOnScreen) { // NOTE: see comments in ProcessDirtyRegion() if (fHidden) @@ -685,7 +685,7 @@ WindowLayer::MarkContentDirtyAsync(BRegion& regionOnScreen) void -WindowLayer::InvalidateView(ViewLayer* layer, BRegion& layerRegion) +Window::InvalidateView(View* layer, BRegion& layerRegion) { if (layer && IsVisible() && layer->IsVisible()) { @@ -707,7 +707,7 @@ WindowLayer::InvalidateView(ViewLayer* layer, BRegion& layerRegion) // DisableUpdateRequests void -WindowLayer::DisableUpdateRequests() +Window::DisableUpdateRequests() { fUpdatesEnabled = false; } @@ -715,7 +715,7 @@ WindowLayer::DisableUpdateRequests() // EnableUpdateRequests void -WindowLayer::EnableUpdateRequests() +Window::EnableUpdateRequests() { fUpdatesEnabled = true; if (!fUpdateRequested && fPendingUpdateSession->IsUsed()) @@ -726,15 +726,15 @@ WindowLayer::EnableUpdateRequests() void -WindowLayer::MouseDown(BMessage* message, BPoint where, int32* _viewToken) +Window::MouseDown(BMessage* message, BPoint where, int32* _viewToken) { // TODO: move into Decorator if (!fBorderRegionValid) GetBorderRegion(&fBorderRegion); - // default action is to drag the WindowLayer + // default action is to drag the Window if (fBorderRegion.Contains(where)) { - // clicking WindowLayer visible area + // clicking Window visible area click_type action = DEC_DRAG; @@ -830,11 +830,11 @@ WindowLayer::MouseDown(BMessage* message, BPoint where, int32* _viewToken) } } else { // click was inside the window contents - if (ViewLayer* view = ViewAt(where)) { + if (View* view = ViewAt(where)) { if (HasModal()) return; - // clicking a simple ViewLayer + // clicking a simple View if (!IsFocus()) { DesktopSettings desktopSettings(fDesktop); @@ -864,7 +864,7 @@ WindowLayer::MouseDown(BMessage* message, BPoint where, int32* _viewToken) void -WindowLayer::MouseUp(BMessage* message, BPoint where, int32* _viewToken) +Window::MouseUp(BMessage* message, BPoint where, int32* _viewToken) { bool invalidate = false; if (fDecorator) { @@ -924,7 +924,7 @@ WindowLayer::MouseUp(BMessage* message, BPoint where, int32* _viewToken) fIsResizing = false; fIsSlidingTab = false; - if (ViewLayer* view = ViewAt(where)) { + if (View* view = ViewAt(where)) { if (HasModal()) return; @@ -935,7 +935,7 @@ WindowLayer::MouseUp(BMessage* message, BPoint where, int32* _viewToken) void -WindowLayer::MouseMoved(BMessage *message, BPoint where, int32* _viewToken, +Window::MouseMoved(BMessage *message, BPoint where, int32* _viewToken, bool isLatestMouseMoved) { #if 0 @@ -949,7 +949,7 @@ WindowLayer::MouseMoved(BMessage *message, BPoint where, int32* _viewToken, } #endif - ViewLayer* view = ViewAt(where); + View* view = ViewAt(where); if (view != NULL) *_viewToken = view->Token(); @@ -1070,7 +1070,7 @@ WindowLayer::MouseMoved(BMessage *message, BPoint where, int32* _viewToken, void -WindowLayer::WorkspaceActivated(int32 index, bool active) +Window::WorkspaceActivated(int32 index, bool active) { if (!active) fWindow->HandleDirectConnection(B_DIRECT_STOP); @@ -1088,7 +1088,7 @@ WindowLayer::WorkspaceActivated(int32 index, bool active) void -WindowLayer::WorkspacesChanged(uint32 oldWorkspaces, uint32 newWorkspaces) +Window::WorkspacesChanged(uint32 oldWorkspaces, uint32 newWorkspaces) { fWorkspaces = newWorkspaces; @@ -1102,7 +1102,7 @@ WindowLayer::WorkspacesChanged(uint32 oldWorkspaces, uint32 newWorkspaces) void -WindowLayer::Activated(bool active) +Window::Activated(bool active) { BMessage msg(B_WINDOW_ACTIVATED); msg.AddBool("active", active); @@ -1114,7 +1114,7 @@ WindowLayer::Activated(bool active) void -WindowLayer::SetTitle(const char* name, BRegion& dirty) +Window::SetTitle(const char* name, BRegion& dirty) { // rebuild the clipping for the title area // and redraw it. @@ -1131,7 +1131,7 @@ WindowLayer::SetTitle(const char* name, BRegion& dirty) void -WindowLayer::SetFocus(bool focus) +Window::SetFocus(bool focus) { // executed from Desktop thread // it holds the clipping write lock, @@ -1154,7 +1154,7 @@ WindowLayer::SetFocus(bool focus) void -WindowLayer::SetHidden(bool hidden) +Window::SetHidden(bool hidden) { // the desktop takes care of dirty regions if (fHidden != hidden) { @@ -1168,7 +1168,7 @@ WindowLayer::SetHidden(bool hidden) void -WindowLayer::SetMinimized(bool minimized) +Window::SetMinimized(bool minimized) { if (minimized == fMinimized) return; @@ -1178,7 +1178,7 @@ WindowLayer::SetMinimized(bool minimized) bool -WindowLayer::IsVisible() const +Window::IsVisible() const { if (IsOffscreenWindow()) return true; @@ -1195,7 +1195,7 @@ WindowLayer::IsVisible() const void -WindowLayer::SetSizeLimits(int32 minWidth, int32 maxWidth, +Window::SetSizeLimits(int32 minWidth, int32 maxWidth, int32 minHeight, int32 maxHeight) { if (minWidth < 0) @@ -1220,7 +1220,7 @@ WindowLayer::SetSizeLimits(int32 minWidth, int32 maxWidth, void -WindowLayer::GetSizeLimits(int32* minWidth, int32* maxWidth, +Window::GetSizeLimits(int32* minWidth, int32* maxWidth, int32* minHeight, int32* maxHeight) const { *minWidth = fMinWidth; @@ -1231,7 +1231,7 @@ WindowLayer::GetSizeLimits(int32* minWidth, int32* maxWidth, bool -WindowLayer::SetTabLocation(float location, BRegion& dirty) +Window::SetTabLocation(float location, BRegion& dirty) { bool ret = false; if (fDecorator) { @@ -1244,7 +1244,7 @@ WindowLayer::SetTabLocation(float location, BRegion& dirty) float -WindowLayer::TabLocation() const +Window::TabLocation() const { if (fDecorator) return fDecorator->TabLocation(); @@ -1253,7 +1253,7 @@ WindowLayer::TabLocation() const bool -WindowLayer::SetDecoratorSettings(const BMessage& settings, BRegion& dirty) +Window::SetDecoratorSettings(const BMessage& settings, BRegion& dirty) { bool ret = false; if (fDecorator) { @@ -1266,7 +1266,7 @@ WindowLayer::SetDecoratorSettings(const BMessage& settings, BRegion& dirty) bool -WindowLayer::GetDecoratorSettings(BMessage* settings) +Window::GetDecoratorSettings(BMessage* settings) { if (fDecorator) return fDecorator->GetSettings(settings); @@ -1276,7 +1276,7 @@ WindowLayer::GetDecoratorSettings(BMessage* settings) void -WindowLayer::SetLook(window_look look, BRegion* updateRegion) +Window::SetLook(window_look look, BRegion* updateRegion) { if (fDecorator == NULL && look != B_NO_BORDER_WINDOW_LOOK) { // we need a new decorator @@ -1314,7 +1314,7 @@ WindowLayer::SetLook(window_look look, BRegion* updateRegion) void -WindowLayer::SetFeel(window_feel feel) +Window::SetFeel(window_feel feel) { // if the subset list is no longer needed, clear it if ((fFeel == B_MODAL_SUBSET_WINDOW_FEEL || fFeel == B_FLOATING_SUBSET_WINDOW_FEEL) @@ -1336,7 +1336,7 @@ WindowLayer::SetFeel(window_feel feel) void -WindowLayer::SetFlags(uint32 flags, BRegion* updateRegion) +Window::SetFlags(uint32 flags, BRegion* updateRegion) { fOriginalFlags = flags; fFlags = flags & ValidWindowFlags(fFeel); @@ -1366,14 +1366,14 @@ WindowLayer::SetFlags(uint32 flags, BRegion* updateRegion) specified \a index. */ bool -WindowLayer::InWorkspace(int32 index) const +Window::InWorkspace(int32 index) const { return (fWorkspaces & (1UL << index)) != 0; } bool -WindowLayer::SupportsFront() +Window::SupportsFront() { if (fFeel == kDesktopWindowFeel || fFeel == kMenuWindowFeel @@ -1385,30 +1385,30 @@ WindowLayer::SupportsFront() bool -WindowLayer::IsModal() const +Window::IsModal() const { return IsModalFeel(fFeel); } bool -WindowLayer::IsFloating() const +Window::IsFloating() const { return IsFloatingFeel(fFeel); } bool -WindowLayer::IsNormal() const +Window::IsNormal() const { return !IsFloatingFeel(fFeel) && !IsModalFeel(fFeel); } bool -WindowLayer::HasModal() const +Window::HasModal() const { - for (WindowLayer* window = NextWindow(fCurrentWorkspace); window != NULL; + for (Window* window = NextWindow(fCurrentWorkspace); window != NULL; window = window->NextWindow(fCurrentWorkspace)) { if (window->IsHidden() || !window->IsModal()) continue; @@ -1425,8 +1425,8 @@ WindowLayer::HasModal() const this window can get. Returns NULL is this window can be the backmost window. */ -WindowLayer* -WindowLayer::Backmost(WindowLayer* window, int32 workspace) +Window* +Window::Backmost(Window* window, int32 workspace) { if (workspace == -1) workspace = fCurrentWorkspace; @@ -1454,8 +1454,8 @@ WindowLayer::Backmost(WindowLayer* window, int32 workspace) this window can get. Returns NULL if this window can be the frontmost window. */ -WindowLayer* -WindowLayer::Frontmost(WindowLayer* first, int32 workspace) +Window* +Window::Frontmost(Window* first, int32 workspace) { if (workspace == -1) workspace = fCurrentWorkspace; @@ -1466,7 +1466,7 @@ WindowLayer::Frontmost(WindowLayer* first, int32 workspace) if (first == NULL) first = NextWindow(workspace); - for (WindowLayer* window = first; window != NULL; + for (Window* window = first; window != NULL; window = window->NextWindow(workspace)) { if (window->IsHidden() || window == this) continue; @@ -1480,21 +1480,21 @@ WindowLayer::Frontmost(WindowLayer* first, int32 workspace) bool -WindowLayer::AddToSubset(WindowLayer* window) +Window::AddToSubset(Window* window) { return fSubsets.AddItem(window); } void -WindowLayer::RemoveFromSubset(WindowLayer* window) +Window::RemoveFromSubset(Window* window) { fSubsets.RemoveItem(window); } bool -WindowLayer::HasInSubset(const WindowLayer* window) const +Window::HasInSubset(const Window* window) const { if (window == NULL || fFeel == window->Feel() || fFeel == B_NORMAL_WINDOW_FEEL) @@ -1531,11 +1531,10 @@ WindowLayer::HasInSubset(const WindowLayer* window) const /*! \brief Collects all workspaces views in this window and puts it into \a list */ void -WindowLayer::FindWorkspacesViews(BObjectList& list) const +Window::FindWorkspacesViews(BObjectList& list) const { int32 count = fWorkspacesViewCount; - TopLayer()->FindViews(kWorkspacesViewFlag, (BObjectList&)list, - count); + fTopLayer->FindViews(kWorkspacesViewFlag, (BObjectList&)list, count); } @@ -1546,14 +1545,14 @@ WindowLayer::FindWorkspacesViews(BObjectList& list) const to have a subset as front window to be visible. */ uint32 -WindowLayer::SubsetWorkspaces() const +Window::SubsetWorkspaces() const { if (fFeel == B_MODAL_ALL_WINDOW_FEEL || fFeel == B_FLOATING_ALL_WINDOW_FEEL) return B_ALL_WORKSPACES; if (fFeel == B_FLOATING_APP_WINDOW_FEEL) { - WindowLayer* front = fDesktop->FrontWindow(); + Window* front = fDesktop->FrontWindow(); if (front != NULL && front->IsNormal() && front->ServerWindow()->App() == ServerWindow()->App()) return ServerWindow()->App()->Workspaces(); @@ -1577,7 +1576,7 @@ WindowLayer::SubsetWorkspaces() const uint32 workspaces = 0; bool hasNormalFront = false; for (int32 i = 0; i < fSubsets.CountItems(); i++) { - WindowLayer* window = fSubsets.ItemAt(i); + Window* window = fSubsets.ItemAt(i); if (!window->IsHidden()) workspaces |= window->Workspaces(); @@ -1600,7 +1599,7 @@ WindowLayer::SubsetWorkspaces() const /*static*/ bool -WindowLayer::IsValidLook(window_look look) +Window::IsValidLook(window_look look) { return look == B_TITLED_WINDOW_LOOK || look == B_DOCUMENT_WINDOW_LOOK @@ -1615,7 +1614,7 @@ WindowLayer::IsValidLook(window_look look) /*static*/ bool -WindowLayer::IsValidFeel(window_feel feel) +Window::IsValidFeel(window_feel feel) { return feel == B_NORMAL_WINDOW_FEEL || feel == B_MODAL_SUBSET_WINDOW_FEEL @@ -1632,7 +1631,7 @@ WindowLayer::IsValidFeel(window_feel feel) /*static*/ bool -WindowLayer::IsModalFeel(window_feel feel) +Window::IsModalFeel(window_feel feel) { return feel == B_MODAL_SUBSET_WINDOW_FEEL || feel == B_MODAL_APP_WINDOW_FEEL @@ -1642,7 +1641,7 @@ WindowLayer::IsModalFeel(window_feel feel) /*static*/ bool -WindowLayer::IsFloatingFeel(window_feel feel) +Window::IsFloatingFeel(window_feel feel) { return feel == B_FLOATING_SUBSET_WINDOW_FEEL || feel == B_FLOATING_APP_WINDOW_FEEL @@ -1652,7 +1651,7 @@ WindowLayer::IsFloatingFeel(window_feel feel) /*static*/ uint32 -WindowLayer::ValidWindowFlags() +Window::ValidWindowFlags() { return B_NOT_MOVABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_NOT_RESIZABLE @@ -1671,7 +1670,7 @@ WindowLayer::ValidWindowFlags() /*static*/ uint32 -WindowLayer::ValidWindowFlags(window_feel feel) +Window::ValidWindowFlags(window_feel feel) { uint32 flags = ValidWindowFlags(); if (IsModalFeel(feel)) @@ -1686,7 +1685,7 @@ WindowLayer::ValidWindowFlags(window_feel feel) // _ShiftPartOfRegion void -WindowLayer::_ShiftPartOfRegion(BRegion* region, BRegion* regionToShift, +Window::_ShiftPartOfRegion(BRegion* region, BRegion* regionToShift, int32 xOffset, int32 yOffset) { BRegion* common = fRegionPool.GetRegion(*regionToShift); @@ -1706,7 +1705,7 @@ WindowLayer::_ShiftPartOfRegion(BRegion* region, BRegion* regionToShift, void -WindowLayer::_TriggerContentRedraw(BRegion& dirtyContentRegion) +Window::_TriggerContentRedraw(BRegion& dirtyContentRegion) { if (IsVisible() && dirtyContentRegion.CountRects() > 0) { // put this into the pending dirty region @@ -1742,7 +1741,7 @@ WindowLayer::_TriggerContentRedraw(BRegion& dirtyContentRegion) void -WindowLayer::_DrawBorder() +Window::_DrawBorder() { // this is executed in the window thread, but only // in respond to a REDRAW message having been received, the @@ -1790,7 +1789,7 @@ fWindow->ResyncDrawState(); the clipping lock held */ void -WindowLayer::_TransferToUpdateSession(BRegion* contentDirtyRegion) +Window::_TransferToUpdateSession(BRegion* contentDirtyRegion) { if (contentDirtyRegion->CountRects() <= 0) return; @@ -1832,7 +1831,7 @@ WindowLayer::_TransferToUpdateSession(BRegion* contentDirtyRegion) // _SendUpdateMessage void -WindowLayer::_SendUpdateMessage() +Window::_SendUpdateMessage() { if (!fUpdatesEnabled) return; @@ -1846,11 +1845,11 @@ WindowLayer::_SendUpdateMessage() void -WindowLayer::BeginUpdate(BPrivate::PortLink& link) +Window::BeginUpdate(BPrivate::PortLink& link) { // NOTE: since we might "shift" parts of the // internal dirty regions from the desktop thread - // in response to WindowLayer::ResizeBy(), which + // in response to Window::ResizeBy(), which // might move arround views, the user of this function // needs to hold the global clipping lock so that the internal // dirty regions are not messed with from the Desktop thread @@ -1872,7 +1871,7 @@ WindowLayer::BeginUpdate(BPrivate::PortLink& link) // TODO: each view could be drawn individually // right before carrying out the first drawing // command from the client during an update - // (ViewLayer::IsBackgroundDirty() can be used + // (View::IsBackgroundDirty() can be used // for this) if (!fContentRegionValid) _UpdateContentRegion(); @@ -1928,13 +1927,13 @@ WindowLayer::BeginUpdate(BPrivate::PortLink& link) printf("BeginUpdate() but no update requested!!\n"); link.StartMessage(B_ERROR); link.Flush(); - fprintf(stderr, "WindowLayer::BeginUpdate() - no update requested!\n"); + fprintf(stderr, "Window::BeginUpdate() - no update requested!\n"); } } void -WindowLayer::EndUpdate() +Window::EndUpdate() { // NOTE: see comment in _BeginUpdate() @@ -1954,7 +1953,7 @@ WindowLayer::EndUpdate() void -WindowLayer::_UpdateContentRegion() +Window::_UpdateContentRegion() { fContentRegion.Set(fFrame); @@ -1971,7 +1970,7 @@ WindowLayer::_UpdateContentRegion() click_type -WindowLayer::_ActionFor(const BMessage* msg) const +Window::_ActionFor(const BMessage* msg) const { if (fDecorator == NULL) return DEC_NONE; @@ -1993,7 +1992,7 @@ WindowLayer::_ActionFor(const BMessage* msg) const void -WindowLayer::_ObeySizeLimits() +Window::_ObeySizeLimits() { // make sure we even have valid size limits if (fMaxWidth < fMinWidth) @@ -2038,7 +2037,7 @@ WindowLayer::_ObeySizeLimits() // #pragma mark - UpdateSession -WindowLayer::UpdateSession::UpdateSession() +Window::UpdateSession::UpdateSession() : fDirtyRegion(), fInUse(false), fCause(0) @@ -2046,34 +2045,34 @@ WindowLayer::UpdateSession::UpdateSession() } -WindowLayer::UpdateSession::~UpdateSession() +Window::UpdateSession::~UpdateSession() { } void -WindowLayer::UpdateSession::Include(BRegion* additionalDirty) +Window::UpdateSession::Include(BRegion* additionalDirty) { fDirtyRegion.Include(additionalDirty); } void -WindowLayer::UpdateSession::Exclude(BRegion* dirtyInNextSession) +Window::UpdateSession::Exclude(BRegion* dirtyInNextSession) { fDirtyRegion.Exclude(dirtyInNextSession); } void -WindowLayer::UpdateSession::MoveBy(int32 x, int32 y) +Window::UpdateSession::MoveBy(int32 x, int32 y) { fDirtyRegion.OffsetBy(x, y); } void -WindowLayer::UpdateSession::SetUsed(bool used) +Window::UpdateSession::SetUsed(bool used) { fInUse = used; if (!fInUse) { @@ -2084,7 +2083,7 @@ WindowLayer::UpdateSession::SetUsed(bool used) void -WindowLayer::UpdateSession::AddCause(uint8 cause) +Window::UpdateSession::AddCause(uint8 cause) { fCause |= cause; } diff --git a/src/servers/app/WindowLayer.h b/src/servers/app/Window.h similarity index 84% rename from src/servers/app/WindowLayer.h rename to src/servers/app/Window.h index 4d09bdcc9c..8c67f25b13 100644 --- a/src/servers/app/WindowLayer.h +++ b/src/servers/app/Window.h @@ -8,14 +8,14 @@ * Stephan Aßmus * Axel Dörfler, axeld@pinc-software.de */ -#ifndef WINDOW_LAYER_H -#define WINDOW_LAYER_H +#ifndef WINDOW_H +#define WINDOW_H #include "Decorator.h" -#include "ViewLayer.h" #include "RegionPool.h" #include "ServerWindow.h" +#include "View.h" #include "WindowList.h" #include @@ -31,7 +31,7 @@ class Decorator; class Desktop; class DrawingEngine; class EventDispatcher; -class WorkspacesLayer; +class WorkspacesView; // TODO: move this into a proper place #define AS_REDRAW 'rdrw' @@ -41,22 +41,21 @@ enum { UPDATE_EXPOSE = 0x02, }; -class WindowLayer { +class Window { public: - WindowLayer(const BRect& frame, - const char *name, window_look look, - window_feel feel, uint32 flags, - uint32 workspaces, - ::ServerWindow* window, - DrawingEngine* drawingEngine); - virtual ~WindowLayer(); + Window(const BRect& frame, const char *name, + window_look look, window_feel feel, + uint32 flags, uint32 workspaces, + ::ServerWindow* window, + DrawingEngine* drawingEngine); + virtual ~Window(); BRect Frame() const { return fFrame; } const char* Title() const { return fTitle.String(); } window_anchor& Anchor(int32 index); - WindowLayer* NextWindow(int32 index) const; - WindowLayer* PreviousWindow(int32 index) const; + Window* NextWindow(int32 index) const; + Window* PreviousWindow(int32 index) const; ::Desktop* Desktop() const { return fDesktop; } ::Decorator* Decorator() const { return fDecorator; } @@ -71,7 +70,7 @@ public: BRegion& VisibleContentRegion(); // TODO: not protected by a lock, but noone should need this anyways - // make private? when used inside WindowLayer, it has the ReadLock() + // make private? when used inside Window, it has the ReadLock() void GetFullRegion(BRegion* region); void GetBorderRegion(BRegion* region); void GetContentRegion(BRegion* region); @@ -79,18 +78,16 @@ public: void MoveBy(int32 x, int32 y); void ResizeBy(int32 x, int32 y, BRegion* dirtyRegion); - void ScrollViewBy(ViewLayer* view, int32 dx, int32 dy); + void ScrollViewBy(View* view, int32 dx, int32 dy); - void SetTopLayer(ViewLayer* topLayer); - ViewLayer* TopLayer() const { return fTopLayer; } - // TODO: only used for WorkspacesLayer, can go away if we do - // this differently one day - ViewLayer* ViewAt(const BPoint& where); + void SetTopLayer(View* topLayer); + View* TopLayer() const { return fTopLayer; } + View* ViewAt(const BPoint& where); virtual bool IsOffscreenWindow() const { return false; } - void GetEffectiveDrawingRegion(ViewLayer* layer, BRegion& region); - bool DrawingRegionChanged(ViewLayer* layer) const; + void GetEffectiveDrawingRegion(View* layer, BRegion& region); + bool DrawingRegionChanged(View* layer) const; // generic version, used by the Desktop void ProcessDirtyRegion(BRegion& regionOnScreen); @@ -103,7 +100,7 @@ public: void MarkContentDirty(BRegion& regionOnScreen); void MarkContentDirtyAsync(BRegion& regionOnScreen); // shortcut for invalidating just one view - void InvalidateView(ViewLayer* view, BRegion& layerRegion); + void InvalidateView(View* view, BRegion& layerRegion); void DisableUpdateRequests(); void EnableUpdateRequests(); @@ -130,7 +127,7 @@ public: { fRegionPool.Recycle(region); } void CopyContents(BRegion* region, - int32 xOffset, int32 yOffset); + int32 xOffset, int32 yOffset); void MouseDown(BMessage* message, BPoint where, int32* _viewToken); void MouseUp(BMessage* message, BPoint where, int32* _viewToken); @@ -200,13 +197,15 @@ public: bool HasModal() const; - WindowLayer* Frontmost(WindowLayer* first = NULL, int32 workspace = -1); - WindowLayer* Backmost(WindowLayer* first = NULL, int32 workspace = -1); + Window* Frontmost(Window* first = NULL, + int32 workspace = -1); + Window* Backmost(Window* first = NULL, + int32 workspace = -1); - bool AddToSubset(WindowLayer* window); - void RemoveFromSubset(WindowLayer* window); - bool HasInSubset(const WindowLayer* window) const; - bool SameSubset(WindowLayer* window); + bool AddToSubset(Window* window); + void RemoveFromSubset(Window* window); + bool HasInSubset(const Window* window) const; + bool SameSubset(Window* window); uint32 SubsetWorkspaces() const; bool HasWorkspacesViews() const @@ -216,7 +215,7 @@ public: void RemoveWorkspacesView() { fWorkspacesViewCount--; } void FindWorkspacesViews( - BObjectList& list) const; + BObjectList& list) const; static bool IsValidLook(window_look look); static bool IsValidFeel(window_feel feel); @@ -230,8 +229,9 @@ protected: friend class Desktop; // TODO: for now (list management) - void _ShiftPartOfRegion(BRegion* region, BRegion* regionToShift, - int32 xOffset, int32 yOffset); + void _ShiftPartOfRegion(BRegion* region, + BRegion* regionToShift, int32 xOffset, + int32 yOffset); // different types of drawing void _TriggerContentRedraw(BRegion& dirty); @@ -280,7 +280,7 @@ protected: ::RegionPool fRegionPool; - BObjectList fSubsets; + BObjectList fSubsets; // TODO: remove those some day (let the decorator handle that stuff) bool fIsClosing : 1; @@ -292,7 +292,7 @@ protected: bool fActivateOnMouseUp : 1; ::Decorator* fDecorator; - ViewLayer* fTopLayer; + View* fTopLayer; ::ServerWindow* fWindow; DrawingEngine* fDrawingEngine; ::Desktop* fDesktop; @@ -366,4 +366,4 @@ protected: int32 fWorkspacesViewCount; }; -#endif // WINDOW_LAYER_H +#endif // WINDOW_H diff --git a/src/servers/app/WindowList.cpp b/src/servers/app/WindowList.cpp index a50fb1eec2..2fef7f2829 100644 --- a/src/servers/app/WindowList.cpp +++ b/src/servers/app/WindowList.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2006, Haiku, Inc. + * Copyright (c) 2005-2008, Haiku, Inc. * Distributed under the terms of the MIT license. * * Authors: @@ -8,7 +8,7 @@ #include "DesktopSettings.h" -#include "WindowLayer.h" +#include "Window.h" const BPoint kInvalidWindowPosition = BPoint(INFINITY, INFINITY); @@ -52,7 +52,7 @@ WindowList::SetIndex(int32 index) given, it will be inserted right before that window. */ void -WindowList::AddWindow(WindowLayer* window, WindowLayer* before) +WindowList::AddWindow(Window* window, Window* before) { window_anchor& windowAnchor = window->Anchor(fIndex); @@ -88,7 +88,7 @@ WindowList::AddWindow(WindowLayer* window, WindowLayer* before) void -WindowList::RemoveWindow(WindowLayer* window) +WindowList::RemoveWindow(Window* window) { window_anchor& windowAnchor = window->Anchor(fIndex); @@ -117,7 +117,7 @@ WindowList::RemoveWindow(WindowLayer* window) bool -WindowList::HasWindow(WindowLayer* window) const +WindowList::HasWindow(Window* window) const { if (window == NULL) return false; diff --git a/src/servers/app/WindowList.h b/src/servers/app/WindowList.h index 33cfb60d29..8459418f47 100644 --- a/src/servers/app/WindowList.h +++ b/src/servers/app/WindowList.h @@ -13,29 +13,29 @@ #include -class WindowLayer; +class Window; class WindowList { - public: - WindowList(int32 index = 0); - ~WindowList(); +public: + WindowList(int32 index = 0); + ~WindowList(); - void SetIndex(int32 index); - int32 Index() const { return fIndex; } + void SetIndex(int32 index); + int32 Index() const { return fIndex; } + + Window* FirstWindow() { return fFirstWindow; } + Window* LastWindow() { return fLastWindow; } + + void AddWindow(Window* window, Window* before = NULL); + void RemoveWindow(Window* window); + + bool HasWindow(Window* window) const; - WindowLayer* FirstWindow() { return fFirstWindow; } - WindowLayer* LastWindow() { return fLastWindow; } - - void AddWindow(WindowLayer* window, WindowLayer* before = NULL); - void RemoveWindow(WindowLayer* window); - - bool HasWindow(WindowLayer* window) const; - - private: - int32 fIndex; - WindowLayer* fFirstWindow; - WindowLayer* fLastWindow; +private: + int32 fIndex; + Window* fFirstWindow; + Window* fLastWindow; }; enum window_lists { @@ -50,9 +50,9 @@ enum window_lists { struct window_anchor { window_anchor(); - WindowLayer* next; - WindowLayer* previous; - BPoint position; + Window* next; + Window* previous; + BPoint position; }; extern const BPoint kInvalidWindowPosition; diff --git a/src/servers/app/Workspace.cpp b/src/servers/app/Workspace.cpp index d917589a6f..8e9c09bfe9 100644 --- a/src/servers/app/Workspace.cpp +++ b/src/servers/app/Workspace.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2005-2007, Haiku. + * Copyright 2005-2008, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -10,7 +10,7 @@ #include "Desktop.h" #include "Workspace.h" #include "WorkspacePrivate.h" -#include "WindowLayer.h" +#include "Window.h" #include #include @@ -116,7 +116,7 @@ Workspace::SetColor(const rgb_color& color, bool makeDefault) status_t -Workspace::GetNextWindow(WindowLayer*& _window, BPoint& _leftTop) +Workspace::GetNextWindow(Window*& _window, BPoint& _leftTop) { if (fCurrent == NULL) fCurrent = fWorkspace.Windows().FirstWindow(); @@ -138,7 +138,7 @@ Workspace::GetNextWindow(WindowLayer*& _window, BPoint& _leftTop) status_t -Workspace::GetPreviousWindow(WindowLayer*& _window, BPoint& _leftTop) +Workspace::GetPreviousWindow(Window*& _window, BPoint& _leftTop) { if (fCurrent == NULL) fCurrent = fWorkspace.Windows().LastWindow(); diff --git a/src/servers/app/Workspace.h b/src/servers/app/Workspace.h index e5a2bcfa0b..152f277655 100644 --- a/src/servers/app/Workspace.h +++ b/src/servers/app/Workspace.h @@ -1,5 +1,5 @@ /* - * Copyright 2005-2007, Haiku. + * Copyright 2005-2008, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -13,7 +13,7 @@ class Desktop; -class WindowLayer; +class Window; class Workspace { @@ -26,8 +26,8 @@ class Workspace { bool IsCurrent() const { return fCurrentWorkspace; } - status_t GetNextWindow(WindowLayer*& _window, BPoint& _leftTop); - status_t GetPreviousWindow(WindowLayer*& _window, BPoint& _leftTop); + status_t GetNextWindow(Window*& _window, BPoint& _leftTop); + status_t GetPreviousWindow(Window*& _window, BPoint& _leftTop); void RewindWindows(); class Private; @@ -35,7 +35,7 @@ class Workspace { private: Workspace::Private& fWorkspace; Desktop& fDesktop; - WindowLayer* fCurrent; + Window* fCurrent; bool fCurrentWorkspace; }; diff --git a/src/servers/app/WorkspacePrivate.h b/src/servers/app/WorkspacePrivate.h index 50fc7be4a1..58cc220286 100644 --- a/src/servers/app/WorkspacePrivate.h +++ b/src/servers/app/WorkspacePrivate.h @@ -1,5 +1,5 @@ /* - * Copyright 2005, Haiku. + * Copyright 2005-2008, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -51,8 +51,8 @@ class Workspace::Private { void _SetDefaults(); WindowList fWindows; - WindowLayer* fFront; - WindowLayer* fFocus; + Window* fFront; + Window* fFocus; BObjectList fDisplays; diff --git a/src/servers/app/WorkspacesLayer.cpp b/src/servers/app/WorkspacesView.cpp similarity index 89% rename from src/servers/app/WorkspacesLayer.cpp rename to src/servers/app/WorkspacesView.cpp index 1aca8b263d..4ab0b66fb3 100644 --- a/src/servers/app/WorkspacesLayer.cpp +++ b/src/servers/app/WorkspacesView.cpp @@ -8,20 +8,20 @@ */ -#include "WorkspacesLayer.h" +#include "WorkspacesView.h" #include "AppServer.h" #include "Desktop.h" #include "DrawingEngine.h" -#include "WindowLayer.h" +#include "Window.h" #include "Workspace.h" #include -WorkspacesLayer::WorkspacesLayer(BRect frame, BPoint scrollingOffset, +WorkspacesView::WorkspacesView(BRect frame, BPoint scrollingOffset, const char* name, int32 token, uint32 resizeMode, uint32 flags) - : ViewLayer(frame, scrollingOffset, name, token, resizeMode, flags), + : View(frame, scrollingOffset, name, token, resizeMode, flags), fSelectedWindow(NULL), fSelectedWorkspace(-1), fHasMoved(false) @@ -31,15 +31,15 @@ WorkspacesLayer::WorkspacesLayer(BRect frame, BPoint scrollingOffset, } -WorkspacesLayer::~WorkspacesLayer() +WorkspacesView::~WorkspacesView() { } void -WorkspacesLayer::AttachedToWindow(WindowLayer* window) +WorkspacesView::AttachedToWindow(::Window* window) { - ViewLayer::AttachedToWindow(window); + View::AttachedToWindow(window); window->AddWorkspacesView(); window->Desktop()->AddWorkspacesView(this); @@ -47,17 +47,17 @@ WorkspacesLayer::AttachedToWindow(WindowLayer* window) void -WorkspacesLayer::DetachedFromWindow() +WorkspacesView::DetachedFromWindow() { fWindow->Desktop()->RemoveWorkspacesView(this); fWindow->RemoveWorkspacesView(); - ViewLayer::DetachedFromWindow(); + View::DetachedFromWindow(); } void -WorkspacesLayer::_GetGrid(int32& columns, int32& rows) +WorkspacesView::_GetGrid(int32& columns, int32& rows) { DesktopSettings settings(Window()->Desktop()); @@ -78,7 +78,7 @@ WorkspacesLayer::_GetGrid(int32& columns, int32& rows) \brief Returns the frame of the screen for the specified workspace. */ BRect -WorkspacesLayer::_ScreenFrame(int32 i) +WorkspacesView::_ScreenFrame(int32 i) { return Window()->Desktop()->VirtualScreen().Frame(); } @@ -89,7 +89,7 @@ WorkspacesLayer::_ScreenFrame(int32 i) workspaces layer. */ BRect -WorkspacesLayer::_WorkspaceAt(int32 i) +WorkspacesView::_WorkspaceAt(int32 i) { int32 columns, rows; _GetGrid(columns, rows); @@ -126,7 +126,7 @@ WorkspacesLayer::_WorkspaceAt(int32 i) an empty rectangle is returned, and \a index is set to -1. */ BRect -WorkspacesLayer::_WorkspaceAt(BPoint where, int32& index) +WorkspacesView::_WorkspaceAt(BPoint where, int32& index) { int32 columns, rows; _GetGrid(columns, rows); @@ -143,7 +143,7 @@ WorkspacesLayer::_WorkspaceAt(BPoint where, int32& index) BRect -WorkspacesLayer::_WindowFrame(const BRect& workspaceFrame, +WorkspacesView::_WindowFrame(const BRect& workspaceFrame, const BRect& screenFrame, const BRect& windowFrame, BPoint windowPosition) { @@ -164,9 +164,9 @@ WorkspacesLayer::_WindowFrame(const BRect& workspaceFrame, void -WorkspacesLayer::_DrawWindow(DrawingEngine* drawingEngine, const BRect& workspaceFrame, - const BRect& screenFrame, WindowLayer* window, BPoint windowPosition, - BRegion& backgroundRegion, bool active) +WorkspacesView::_DrawWindow(DrawingEngine* drawingEngine, + const BRect& workspaceFrame, const BRect& screenFrame, ::Window* window, + BPoint windowPosition, BRegion& backgroundRegion, bool active) { if (window->Feel() == kDesktopWindowFeel || window->IsHidden()) return; @@ -226,7 +226,7 @@ WorkspacesLayer::_DrawWindow(DrawingEngine* drawingEngine, const BRect& workspac // draw title // TODO: disabled because it's much too slow this way - the mini-window - // functionality should probably be moved into the WindowLayer class, + // functionality should probably be moved into the Window class, // so that it has only to be recalculated on demand. With double buffered // windows, this would also open up the door to have a more detailed // preview. @@ -252,7 +252,7 @@ WorkspacesLayer::_DrawWindow(DrawingEngine* drawingEngine, const BRect& workspac void -WorkspacesLayer::_DrawWorkspace(DrawingEngine* drawingEngine, +WorkspacesView::_DrawWorkspace(DrawingEngine* drawingEngine, BRegion& redraw, int32 index) { BRect rect = _WorkspaceAt(index); @@ -288,7 +288,7 @@ WorkspacesLayer::_DrawWorkspace(DrawingEngine* drawingEngine, // We draw from top down and cut the window out of the clipping region // which reduces the flickering - WindowLayer* window; + ::Window* window; BPoint leftTop; while (workspace.GetPreviousWindow(window, leftTop) == B_OK) { _DrawWindow(drawingEngine, rect, screenFrame, window, @@ -303,14 +303,14 @@ WorkspacesLayer::_DrawWorkspace(DrawingEngine* drawingEngine, void -WorkspacesLayer::_DarkenColor(rgb_color& color) const +WorkspacesView::_DarkenColor(rgb_color& color) const { color = tint_color(color, B_DARKEN_2_TINT); } void -WorkspacesLayer::_Invalidate() const +WorkspacesView::_Invalidate() const { BRect frame = Bounds(); ConvertToScreen(&frame); @@ -321,7 +321,7 @@ WorkspacesLayer::_Invalidate() const void -WorkspacesLayer::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping, +WorkspacesView::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping, BRegion* windowContentClipping, bool deep) { // we can only draw within our own area @@ -377,7 +377,7 @@ WorkspacesLayer::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping, void -WorkspacesLayer::MouseDown(BMessage* message, BPoint where) +WorkspacesView::MouseDown(BMessage* message, BPoint where) { // reset tracking variables fSelectedWorkspace = -1; @@ -400,7 +400,7 @@ WorkspacesLayer::MouseDown(BMessage* message, BPoint where) BRect screenFrame = _ScreenFrame(index); - WindowLayer* window; + ::Window* window; BRect windowFrame; BPoint leftTop; while (workspace.GetPreviousWindow(window, leftTop) == B_OK) { @@ -453,7 +453,7 @@ WorkspacesLayer::MouseDown(BMessage* message, BPoint where) void -WorkspacesLayer::MouseUp(BMessage* message, BPoint where) +WorkspacesView::MouseUp(BMessage* message, BPoint where) { if (!fHasMoved && fSelectedWorkspace >= 0) { int32 index; @@ -473,7 +473,7 @@ WorkspacesLayer::MouseUp(BMessage* message, BPoint where) void -WorkspacesLayer::MouseMoved(BMessage* message, BPoint where) +WorkspacesView::MouseMoved(BMessage* message, BPoint where) { if (fSelectedWindow == NULL && fSelectedWorkspace < 0) return; @@ -537,7 +537,7 @@ WorkspacesLayer::MouseMoved(BMessage* message, BPoint where) void -WorkspacesLayer::WindowChanged(WindowLayer* window) +WorkspacesView::WindowChanged(::Window* window) { // TODO: be smarter about this! _Invalidate(); @@ -545,7 +545,7 @@ WorkspacesLayer::WindowChanged(WindowLayer* window) void -WorkspacesLayer::WindowRemoved(WindowLayer* window) +WorkspacesView::WindowRemoved(::Window* window) { if (fSelectedWindow == window) fSelectedWindow = NULL; diff --git a/src/servers/app/WorkspacesLayer.h b/src/servers/app/WorkspacesView.h similarity index 73% rename from src/servers/app/WorkspacesLayer.h rename to src/servers/app/WorkspacesView.h index be6d2e5908..58c3fff306 100644 --- a/src/servers/app/WorkspacesLayer.h +++ b/src/servers/app/WorkspacesView.h @@ -5,23 +5,21 @@ * Authors: * Axel Dörfler, axeld@pinc-software.de */ -#ifndef WORKSPACES_LAYER_H -#define WORKSPACES_LAYER_H +#ifndef WORKSPACES_VIEW_H +#define WORKSPACES_VIEW_H -#include "ViewLayer.h" - -class WindowLayer; +#include "View.h" -class WorkspacesLayer : public ViewLayer { +class WorkspacesView : public View { public: - WorkspacesLayer(BRect frame, BPoint scrollingOffset, + WorkspacesView(BRect frame, BPoint scrollingOffset, const char* name, int32 token, uint32 resize, uint32 flags); - virtual ~WorkspacesLayer(); + virtual ~WorkspacesView(); - virtual void AttachedToWindow(WindowLayer* window); + virtual void AttachedToWindow(::Window* window); virtual void DetachedFromWindow(); virtual void Draw(DrawingEngine* drawingEngine, @@ -32,8 +30,8 @@ public: virtual void MouseUp(BMessage* message, BPoint where); virtual void MouseMoved(BMessage* message, BPoint where); - void WindowChanged(WindowLayer* window); - void WindowRemoved(WindowLayer* window); + void WindowChanged(::Window* window); + void WindowRemoved(::Window* window); private: void _GetGrid(int32& columns, int32& rows); @@ -46,7 +44,7 @@ private: void _DrawWindow(DrawingEngine* drawingEngine, const BRect& workspaceFrame, const BRect& screenFrame, - WindowLayer* window, BPoint windowPosition, + ::Window* window, BPoint windowPosition, BRegion& backgroundRegion, bool active); void _DrawWorkspace(DrawingEngine* drawingEngine, BRegion& redraw, int32 index); @@ -55,10 +53,10 @@ private: void _Invalidate() const; private: - WindowLayer* fSelectedWindow; + ::Window* fSelectedWindow; int32 fSelectedWorkspace; bool fHasMoved; BPoint fLeftTopOffset; }; -#endif // WORKSPACES_LAYER_H +#endif // WORKSPACES_VIEW_H