* Removed severly outdated DebugInfoManager.

* More "layer" cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24305 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-03-08 15:28:31 +00:00
parent da3abc7c16
commit 437b19277f
17 changed files with 169 additions and 295 deletions
-67
View File
@@ -1,67 +0,0 @@
/*
* Copyright 2005, Stephan Aßmus <[email protected]>. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Class used to manage global access to on-screen debugging info
* in the RootLayer class.
*
*/
//#include "RootLayer.h"
#include "DebugInfoManager.h"
// init globals
DebugInfoManager*
DebugInfoManager::sDefaultInstance = NULL;
#if ON_SCREEN_DEBUGGING_INFO
char* gDebugString = new char[2048];
#endif
// destructor
DebugInfoManager::~DebugInfoManager()
{
}
// Default
DebugInfoManager*
DebugInfoManager::Default()
{
if (!sDefaultInstance)
sDefaultInstance = new DebugInfoManager();
return sDefaultInstance;
}
// AddInfo
void
DebugInfoManager::AddInfo(const char* string)
{
#if ON_SCREEN_DEBUGGING_INFO
if (fRootLayer) {
fRootLayer->AddDebugInfo(string);
}
#endif // ON_SCREEN_DEBUGGING_INFO
}
// constructor
DebugInfoManager::DebugInfoManager()
#if ON_SCREEN_DEBUGGING_INFO
: fRootLayer(NULL)
{
gDebugString[0] = 0;
}
#else
{
}
#endif // ON_SCREEN_DEBUGGING_INFO
#if ON_SCREEN_DEBUGGING_INFO
// SetRootLayer
void
DebugInfoManager::SetRootLayer(RootLayer* layer)
{
fRootLayer = layer;
}
#endif // ON_SCREEN_DEBUGGING_INFO
-48
View File
@@ -1,48 +0,0 @@
/*
* Copyright 2005, Stephan Aßmus <[email protected]>. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Class used to manage global access to on-screen debugging info
* in the RootLayer class.
*
*/
#ifndef DEBUG_INFO_MANAGER_H
#define DEBUG_INFO_MANAGER_H
#include <OS.h>
#if __HAIKU__
# define ON_SCREEN_DEBUGGING_INFO 0
#else
# define ON_SCREEN_DEBUGGING_INFO 0
#endif
#if ON_SCREEN_DEBUGGING_INFO
extern char* gDebugString;
# define CRITICAL(x) { sprintf(gDebugString, (x)); DebugInfoManager::Default()->AddInfo(gDebugString); }
#else
//# define CRITICAL(x) debugger (x)
# define CRITICAL(x) ;
#endif // ON_SCREEN_DEBUGGING_INFO
class DebugInfoManager {
public:
virtual ~DebugInfoManager();
static DebugInfoManager *Default();
void AddInfo(const char* string);
private:
DebugInfoManager();
static DebugInfoManager *sDefaultInstance;
#if ON_SCREEN_DEBUGGING_INFO
friend class RootLayer;
void SetRootLayer(RootLayer* layer);
RootLayer *fRootLayer;
#endif // ON_SCREEN_DEBUGGING_INFO
};
#endif // DEBUG_INFO_H
+3 -3
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2001-2006, Haiku. * Copyright 2001-2008, Haiku.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -7,7 +7,7 @@
* Stephan Aßmus <[email protected]> * Stephan Aßmus <[email protected]>
*/ */
/** Default and fallback decorator for the app_server - the yellow tabs */ /*! Default and fallback decorator for the app_server - the yellow tabs */
#include "DefaultDecorator.h" #include "DefaultDecorator.h"
@@ -464,7 +464,7 @@ DefaultDecorator::GetFootprint(BRegion *region)
{ {
STRACE(("DefaultDecorator: Get Footprint\n")); STRACE(("DefaultDecorator: Get Footprint\n"));
// This function calculates the decorator's footprint in coordinates // This function calculates the decorator's footprint in coordinates
// relative to the layer. This is most often used to set a WindowLayer // relative to the view. This is most often used to set a Window
// object's visible region. // object's visible region.
if (!region) if (!region)
return; return;
+3 -3
View File
@@ -244,7 +244,7 @@ MouseFilter::Filter(BMessage* message, EventTarget** _target, int32* _viewToken,
window = fDesktop->WindowAt(where); window = fDesktop->WindowAt(where);
if (window != NULL) { if (window != NULL) {
// dispatch event in the window layers // dispatch event to the window
switch (message->what) { switch (message->what) {
case B_MOUSE_DOWN: case B_MOUSE_DOWN:
window->MouseDown(message, where, &viewToken); window->MouseDown(message, where, &viewToken);
@@ -758,7 +758,7 @@ Desktop::RedrawBackground()
// look for desktop background view, and update its background color // look for desktop background view, and update its background color
// TODO: is there a better way to do this? // TODO: is there a better way to do this?
View* view = window->TopLayer(); View* view = window->TopView();
if (view != NULL) if (view != NULL)
view = view->FirstChild(); view = view->FirstChild();
@@ -1661,7 +1661,7 @@ Desktop::ShowWindow(Window* window)
} }
if (window->HasWorkspacesViews()) { if (window->HasWorkspacesViews()) {
// find workspaces layer in view hierarchy // find workspaces views in view hierarchy
window->FindWorkspacesViews(fWorkspacesViews); window->FindWorkspacesViews(fWorkspacesViews);
} }
+1 -1
View File
@@ -162,7 +162,7 @@ class DrawState {
bool fFontAliasing; bool fFontAliasing;
// This is not part of the normal state stack. // This is not part of the normal state stack.
// Layer will update it in PushState/PopState. // The view will update it in PushState/PopState.
// A BView can have a flag "B_SUBPIXEL_PRECISE", // A BView can have a flag "B_SUBPIXEL_PRECISE",
// I never knew what it does on R5, but I can use // I never knew what it does on R5, but I can use
// it in Painter to actually draw stuff with // it in Painter to actually draw stuff with
-1
View File
@@ -17,7 +17,6 @@ Server app_server :
CursorData.cpp CursorData.cpp
CursorManager.cpp CursorManager.cpp
CursorSet.cpp CursorSet.cpp
DebugInfoManager.cpp
DecorManager.cpp DecorManager.cpp
Decorator.cpp Decorator.cpp
DefaultDecorator.cpp DefaultDecorator.cpp
+1 -2
View File
@@ -14,7 +14,6 @@
#include <Debug.h> #include <Debug.h>
#include "BitmapHWInterface.h" #include "BitmapHWInterface.h"
#include "DebugInfoManager.h"
#include "DrawingEngine.h" #include "DrawingEngine.h"
#include "ServerBitmap.h" #include "ServerBitmap.h"
@@ -41,7 +40,7 @@ OffscreenWindow::OffscreenWindow(ServerBitmap* bitmap,
OffscreenWindow::~OffscreenWindow() OffscreenWindow::~OffscreenWindow()
{ {
fHWInterface->LockExclusiveAccess(); fHWInterface->LockExclusiveAccess();
// Unlike normal Layers, we own the DrawingEngine instance // Unlike normal windows, we own the DrawingEngine instance
delete GetDrawingEngine(); delete GetDrawingEngine();
fHWInterface->Shutdown(); fHWInterface->Shutdown();
fHWInterface->UnlockExclusiveAccess(); fHWInterface->UnlockExclusiveAccess();
+2 -2
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2007: string = ""; break; Haiku: string = ""; break; Inc. All rights reserved. * Copyright 2007-2008, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -215,7 +215,7 @@ string_for_message_code(uint32 code, BString& string)
case AS_LAYER_RESIZE: string = "AS_LAYER_RESIZE"; break; case AS_LAYER_RESIZE: string = "AS_LAYER_RESIZE"; break;
case AS_LAYER_DRAW: string = "AS_LAYER_DRAW"; break; case AS_LAYER_DRAW: string = "AS_LAYER_DRAW"; break;
// View/Layer definitions // View definitions
case AS_LAYER_GET_COORD: string = "AS_LAYER_GET_COORD"; break; case AS_LAYER_GET_COORD: string = "AS_LAYER_GET_COORD"; break;
case AS_LAYER_SET_FLAGS: string = "AS_LAYER_SET_FLAGS"; break; case AS_LAYER_SET_FLAGS: string = "AS_LAYER_SET_FLAGS"; break;
case AS_LAYER_SET_ORIGIN: string = "AS_LAYER_SET_ORIGIN"; break; case AS_LAYER_SET_ORIGIN: string = "AS_LAYER_SET_ORIGIN"; break;
+1 -4
View File
@@ -21,7 +21,6 @@
#include "CursorManager.h" #include "CursorManager.h"
#include "CursorSet.h" #include "CursorSet.h"
#include "Desktop.h" #include "Desktop.h"
#include "DebugInfoManager.h"
#include "DecorManager.h" #include "DecorManager.h"
#include "DrawingEngine.h" #include "DrawingEngine.h"
#include "EventStream.h" #include "EventStream.h"
@@ -132,9 +131,7 @@ ServerApp::ServerApp(Desktop* desktop, port_id clientReplyPort,
ServerApp::~ServerApp() ServerApp::~ServerApp()
{ {
STRACE(("*ServerApp %s:~ServerApp()\n", Signature())); STRACE(("*ServerApp %s:~ServerApp()\n", Signature()));
ASSERT(fQuitting);
if (!fQuitting)
CRITICAL("ServerApp: destructor called after Run()!\n");
// quit all server windows // quit all server windows
+28 -31
View File
@@ -24,7 +24,6 @@
#include "ServerWindow.h" #include "ServerWindow.h"
#include "AppServer.h" #include "AppServer.h"
#include "DebugInfoManager.h"
#include "Desktop.h" #include "Desktop.h"
#include "DrawingEngine.h" #include "DrawingEngine.h"
#include "HWInterface.h" #include "HWInterface.h"
@@ -345,7 +344,7 @@ ServerWindow::_GetLooperName(char* name, size_t length)
} }
//! Forces the window layer to update its decorator //! Forces the window to update its decorator
void void
ServerWindow::ReplaceDecorator() ServerWindow::ReplaceDecorator()
{ {
@@ -557,28 +556,28 @@ ServerWindow::_CreateView(BPrivate::LinkReceiver &link, View **_parent)
link.Read<rgb_color>(&viewColor); link.Read<rgb_color>(&viewColor);
link.Read<int32>(&parentToken); link.Read<int32>(&parentToken);
STRACE(("ServerWindow(%s)::_CreateView()-> layer %s, token %ld\n", STRACE(("ServerWindow(%s)::_CreateView()-> view %s, token %ld\n",
fTitle, name, token)); fTitle, name, token));
View* newLayer; View* newView;
if ((flags & kWorkspacesViewFlag) != 0) { if ((flags & kWorkspacesViewFlag) != 0) {
newLayer = new (nothrow) WorkspacesView(frame, scrollingOffset, name, newView = new (nothrow) WorkspacesView(frame, scrollingOffset, name,
token, resizeMask, flags); token, resizeMask, flags);
} else { } else {
newLayer = new (nothrow) View(frame, scrollingOffset, name, token, newView = new (nothrow) View(frame, scrollingOffset, name, token,
resizeMask, flags); resizeMask, flags);
} }
free(name); free(name);
if (newLayer == NULL) if (newView == NULL)
return NULL; return NULL;
// there is no way of setting this, other than manually :-) // there is no way of setting this, other than manually :-)
newLayer->SetViewColor(viewColor); newView->SetViewColor(viewColor);
newLayer->SetHidden(hidden); newView->SetHidden(hidden);
newLayer->SetEventMask(eventMask, eventOptions); newView->SetEventMask(eventMask, eventOptions);
if (eventMask != 0 || eventOptions != 0) { if (eventMask != 0 || eventOptions != 0) {
// fDesktop->UnlockSingleWindow(); // fDesktop->UnlockSingleWindow();
@@ -586,7 +585,7 @@ ServerWindow::_CreateView(BPrivate::LinkReceiver &link, View **_parent)
fDesktop->UnlockAllWindows(); fDesktop->UnlockAllWindows();
// TODO: possible deadlock // TODO: possible deadlock
fDesktop->EventDispatcher().AddListener(EventTarget(), fDesktop->EventDispatcher().AddListener(EventTarget(),
newLayer->Token(), eventMask, eventOptions); newView->Token(), eventMask, eventOptions);
fDesktop->LockAllWindows(); fDesktop->LockAllWindows();
// fDesktop->UnlockAllWindows(); // fDesktop->UnlockAllWindows();
// fDesktop->LockSingleWindow(); // fDesktop->LockSingleWindow();
@@ -596,27 +595,27 @@ fDesktop->LockAllWindows();
DesktopSettings settings(fDesktop); DesktopSettings settings(fDesktop);
ServerFont font; ServerFont font;
settings.GetDefaultPlainFont(font); settings.GetDefaultPlainFont(font);
newLayer->CurrentState()->SetFont(font); newView->CurrentState()->SetFont(font);
if (_parent) { if (_parent) {
View *parent; View *parent;
if (App()->ViewTokens().GetToken(parentToken, B_HANDLER_TOKEN, if (App()->ViewTokens().GetToken(parentToken, B_HANDLER_TOKEN,
(void**)&parent) != B_OK (void**)&parent) != B_OK
|| parent->Window()->ServerWindow() != this) { || parent->Window()->ServerWindow() != this) {
CRITICAL("View token not found!\n"); debug_printf("View token not found!\n");
parent = NULL; parent = NULL;
} }
*_parent = parent; *_parent = parent;
} }
return newLayer; return newView;
} }
/*! /*!
Dispatches all window messages, and those view messages that Dispatches all window messages, and those view messages that
don't need a valid fCurrentView (ie. layer creation). don't need a valid fCurrentView (ie. view creation).
*/ */
void void
ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
@@ -1127,7 +1126,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
(void**)&current) != B_OK (void**)&current) != B_OK
|| current->Window()->ServerWindow() != this) { || current->Window()->ServerWindow() != this) {
// ToDo: if this happens, we probably want to kill the app and clean up // ToDo: if this happens, we probably want to kill the app and clean up
fprintf(stderr, "ServerWindow %s: Message AS_SET_CURRENT_LAYER: layer not found, token %ld\n", fTitle, token); fprintf(stderr, "ServerWindow %s: Message AS_SET_CURRENT_LAYER: view not found, token %ld\n", fTitle, token);
current = NULL; current = NULL;
} else { } else {
DTRACE(("ServerWindow %s: Message AS_SET_CURRENT_LAYER: %s, token %ld\n", fTitle, current->Name(), token)); DTRACE(("ServerWindow %s: Message AS_SET_CURRENT_LAYER: %s, token %ld\n", fTitle, current->Name(), token));
@@ -1148,7 +1147,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
} }
_SetCurrentView(_CreateView(link, NULL)); _SetCurrentView(_CreateView(link, NULL));
fWindow->SetTopLayer(fCurrentView); fWindow->SetTopView(fCurrentView);
break; break;
} }
@@ -1157,11 +1156,11 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
STRACE(("ServerWindow %s: Message AS_LAYER_CREATE: View name: %s\n", fTitle, fCurrentView->Name())); STRACE(("ServerWindow %s: Message AS_LAYER_CREATE: View name: %s\n", fTitle, fCurrentView->Name()));
View* parent = NULL; View* parent = NULL;
View* newLayer = _CreateView(link, &parent); View* newView = _CreateView(link, &parent);
if (parent != NULL && newLayer != NULL) if (parent != NULL && newView != NULL)
parent->AddChild(newLayer); parent->AddChild(newView);
else else
fprintf(stderr, "ServerWindow %s: Message AS_LAYER_CREATE: parent or newLayer NULL!!\n", fTitle); fprintf(stderr, "ServerWindow %s: Message AS_LAYER_CREATE: parent or newView NULL!!\n", fTitle);
break; break;
} }
@@ -2890,9 +2889,7 @@ ServerWindow::_MessageLooper()
quitLoop = true; quitLoop = true;
// ServerWindow's destructor takes care of pulling this object off the desktop. // ServerWindow's destructor takes care of pulling this object off the desktop.
if (!fWindow->IsHidden()) ASSERT(fWindow->IsHidden());
CRITICAL("ServerWindow: a window must be hidden before it's deleted\n");
break; break;
} }
@@ -3132,12 +3129,12 @@ ServerWindow::HandleDirectConnection(int32 bufferState, int32 driverState)
void void
ServerWindow::_SetCurrentView(View* layer) ServerWindow::_SetCurrentView(View* view)
{ {
if (fCurrentView == layer) if (fCurrentView == view)
return; return;
fCurrentView = layer; fCurrentView = view;
fCurrentDrawingRegionValid = false; fCurrentDrawingRegionValid = false;
_UpdateDrawState(fCurrentView); _UpdateDrawState(fCurrentView);
@@ -3166,17 +3163,17 @@ ServerWindow::_SetCurrentView(View* layer)
void void
ServerWindow::_UpdateDrawState(View* layer) ServerWindow::_UpdateDrawState(View* view)
{ {
// switch the drawing state // switch the drawing state
// TODO: is it possible to scroll a view while it // TODO: is it possible to scroll a view while it
// is being drawn? probably not... otherwise the // is being drawn? probably not... otherwise the
// "offsets" passed below would need to be updated again // "offsets" passed below would need to be updated again
DrawingEngine* drawingEngine = fWindow->GetDrawingEngine(); DrawingEngine* drawingEngine = fWindow->GetDrawingEngine();
if (layer && drawingEngine) { if (view && drawingEngine) {
BPoint p(0, 0); BPoint p(0, 0);
layer->ConvertToScreenForDrawing(&p); view->ConvertToScreenForDrawing(&p);
drawingEngine->SetDrawState(layer->CurrentState(), p.x, p.y); drawingEngine->SetDrawState(view->CurrentState(), p.x, p.y);
} }
} }
+53 -53
View File
@@ -87,7 +87,7 @@ View::View(IntRect frame, IntPoint scrollingOffset, const char* name,
fResizeMode(resizeMode), fResizeMode(resizeMode),
fFlags(flags), fFlags(flags),
// ViewLayers start visible by default // Views start visible by default
fHidden(false), fHidden(false),
fVisible(true), fVisible(true),
fBackgroundDirty(true), fBackgroundDirty(true),
@@ -123,17 +123,17 @@ View::~View()
delete fDrawState; delete fDrawState;
// if (fWindow && this == fWindow->TopLayer()) // if (fWindow && this == fWindow->TopView())
// fWindow->SetTopLayer(NULL); // fWindow->SetTopView(NULL);
if (fCursor) if (fCursor)
fCursor->Release(); fCursor->Release();
// iterate over children and delete each one // iterate over children and delete each one
View* layer = fFirstChild; View* view = fFirstChild;
while (layer) { while (view) {
View* toast = layer; View* toast = view;
layer = layer->fNextSibling; view = view->fNextSibling;
delete toast; delete toast;
} }
} }
@@ -167,7 +167,7 @@ View::AttachedToWindow(::Window* window)
fWindow = window; fWindow = window;
// an ugly hack to detect the desktop background // an ugly hack to detect the desktop background
if (window->Feel() == kDesktopWindowFeel && Parent() == TopLayer()) if (window->Feel() == kDesktopWindowFeel && Parent() == TopView())
fIsDesktopBackground = true; fIsDesktopBackground = true;
// insert view into local token space // insert view into local token space
@@ -200,36 +200,36 @@ View::DetachedFromWindow()
void void
View::AddChild(View* layer) View::AddChild(View* view)
{ {
if (layer->fParent) { if (view->fParent) {
printf("View::AddChild() - View already has a parent\n"); printf("View::AddChild() - View already has a parent\n");
return; return;
} }
layer->fParent = this; view->fParent = this;
if (!fLastChild) { if (!fLastChild) {
// no children yet // no children yet
fFirstChild = layer; fFirstChild = view;
} else { } else {
// append layer to formerly last child // append view to formerly last child
fLastChild->fNextSibling = layer; fLastChild->fNextSibling = view;
layer->fPreviousSibling = fLastChild; view->fPreviousSibling = fLastChild;
} }
fLastChild = layer; fLastChild = view;
layer->UpdateVisibleDeep(fVisible); view->UpdateVisibleDeep(fVisible);
if (layer->IsVisible()) if (view->IsVisible())
RebuildClipping(false); RebuildClipping(false);
if (fWindow) { if (fWindow) {
layer->AttachedToWindow(fWindow); view->AttachedToWindow(fWindow);
if (layer->IsVisible()) { if (view->IsVisible()) {
// trigger redraw // trigger redraw
IntRect clippedFrame = layer->Frame(); IntRect clippedFrame = view->Frame();
ConvertToVisibleInTopView(&clippedFrame); ConvertToVisibleInTopView(&clippedFrame);
BRegion* dirty = fWindow->GetRegion(); BRegion* dirty = fWindow->GetRegion();
if (dirty) { if (dirty) {
@@ -243,37 +243,37 @@ View::AddChild(View* layer)
bool bool
View::RemoveChild(View* layer) View::RemoveChild(View* view)
{ {
if (layer->fParent != this) { if (view->fParent != this) {
printf("View::RemoveChild(%p - %s) - View is not child of " printf("View::RemoveChild(%p - %s) - View is not child of "
"this (%p) layer!\n", layer, layer ? layer->Name() : NULL, this); "this (%p) view!\n", view, view ? view->Name() : NULL, this);
return false; return false;
} }
layer->fParent = NULL; view->fParent = NULL;
if (fLastChild == layer) if (fLastChild == view)
fLastChild = layer->fPreviousSibling; fLastChild = view->fPreviousSibling;
// layer->fNextSibling would be NULL // view->fNextSibling would be NULL
if (fFirstChild == layer ) if (fFirstChild == view )
fFirstChild = layer->fNextSibling; fFirstChild = view->fNextSibling;
// layer->fPreviousSibling would be NULL // view->fPreviousSibling would be NULL
// connect child before and after layer // connect child before and after view
if (layer->fPreviousSibling) if (view->fPreviousSibling)
layer->fPreviousSibling->fNextSibling = layer->fNextSibling; view->fPreviousSibling->fNextSibling = view->fNextSibling;
if (layer->fNextSibling) if (view->fNextSibling)
layer->fNextSibling->fPreviousSibling = layer->fPreviousSibling; view->fNextSibling->fPreviousSibling = view->fPreviousSibling;
// layer has no siblings anymore // view has no siblings anymore
layer->fPreviousSibling = NULL; view->fPreviousSibling = NULL;
layer->fNextSibling = NULL; view->fNextSibling = NULL;
if (layer->IsVisible()) { if (view->IsVisible()) {
Overlay* overlay = layer->_Overlay(); Overlay* overlay = view->_Overlay();
if (overlay != NULL) if (overlay != NULL)
overlay->Hide(); overlay->Hide();
@@ -281,11 +281,11 @@ View::RemoveChild(View* layer)
} }
if (fWindow) { if (fWindow) {
layer->DetachedFromWindow(); view->DetachedFromWindow();
if (fVisible && layer->IsVisible()) { if (fVisible && view->IsVisible()) {
// trigger redraw // trigger redraw
IntRect clippedFrame = layer->Frame(); IntRect clippedFrame = view->Frame();
ConvertToVisibleInTopView(&clippedFrame); ConvertToVisibleInTopView(&clippedFrame);
BRegion* dirty = fWindow->GetRegion(); BRegion* dirty = fWindow->GetRegion();
if (dirty) { if (dirty) {
@@ -301,13 +301,13 @@ View::RemoveChild(View* layer)
View* View*
View::TopLayer() View::TopView()
{ {
// returns the top level view of the hirarchy, // returns the top level view of the hirarchy,
// it doesn't have to be the top level of a window // it doesn't have to be the top level of a window
if (fParent) if (fParent)
return fParent->TopLayer(); return fParent->TopView();
return this; return this;
} }
@@ -407,9 +407,9 @@ View::ViewAt(const BPoint& where)
return NULL; return NULL;
for (View* child = FirstChild(); child; child = child->NextSibling()) { for (View* child = FirstChild(); child; child = child->NextSibling()) {
View* layer = child->ViewAt(where); View* view = child->ViewAt(where);
if (layer != NULL) if (view != NULL)
return layer; return view;
} }
return this; return this;
@@ -1469,7 +1469,7 @@ View::MarkBackgroundDirty()
void void
View::AddTokensForLayersInRegion(BMessage* message, BRegion& region, View::AddTokensForViewsInRegion(BMessage* message, BRegion& region,
BRegion* windowContentClipping) BRegion* windowContentClipping)
{ {
if (!fVisible) if (!fVisible)
@@ -1479,14 +1479,14 @@ View::AddTokensForLayersInRegion(BMessage* message, BRegion& region,
message->AddInt32("_token", fToken); message->AddInt32("_token", fToken);
for (View* child = FirstChild(); child; child = child->NextSibling()) { for (View* child = FirstChild(); child; child = child->NextSibling()) {
child->AddTokensForLayersInRegion(message, region, child->AddTokensForViewsInRegion(message, region,
windowContentClipping); windowContentClipping);
} }
} }
void void
View::AddTokensForLayersInRegion(BPrivate::PortLink& link, BRegion& region, View::AddTokensForViewsInRegion(BPrivate::PortLink& link, BRegion& region,
BRegion* windowContentClipping) BRegion* windowContentClipping)
{ {
if (!fVisible) if (!fVisible)
@@ -1501,7 +1501,7 @@ View::AddTokensForLayersInRegion(BPrivate::PortLink& link, BRegion& region,
link.Attach<int32>(fToken); link.Attach<int32>(fToken);
for (View* child = FirstChild(); child; child = child->NextSibling()) { for (View* child = FirstChild(); child; child = child->NextSibling()) {
child->AddTokensForLayersInRegion(link, region, windowContentClipping); child->AddTokensForViewsInRegion(link, region, windowContentClipping);
} }
} }
+6 -6
View File
@@ -70,7 +70,7 @@ class View {
float Scale() const; float Scale() const;
void SetUserClipping(const BRegion* region); void SetUserClipping(const BRegion* region);
// region is expected in layer coordinates // region is expected in view coordinates
// converts the given frame up the view hierarchy and // converts the given frame up the view hierarchy and
// clips to each views bounds // clips to each views bounds
@@ -81,8 +81,8 @@ class View {
::Window* Window() const { return fWindow; } ::Window* Window() const { return fWindow; }
// tree stuff // tree stuff
void AddChild(View* layer); void AddChild(View* view);
bool RemoveChild(View* layer); bool RemoveChild(View* view);
inline View* Parent() const inline View* Parent() const
{ return fParent; } { return fParent; }
@@ -96,7 +96,7 @@ class View {
inline View* NextSibling() const inline View* NextSibling() const
{ return fNextSibling; } { return fNextSibling; }
View* TopLayer(); View* TopView();
uint32 CountChildren(bool deep = false) const; uint32 CountChildren(bool deep = false) const;
void CollectTokensForChildren(BList* tokenMap) const; void CollectTokensForChildren(BList* tokenMap) const;
@@ -215,11 +215,11 @@ class View {
bool IsDesktopBackground() const bool IsDesktopBackground() const
{ return fIsDesktopBackground; } { return fIsDesktopBackground; }
void AddTokensForLayersInRegion(BMessage* message, void AddTokensForViewsInRegion(BMessage* message,
BRegion& region, BRegion& region,
BRegion* windowContentClipping); BRegion* windowContentClipping);
void AddTokensForLayersInRegion(BPrivate::PortLink& link, void AddTokensForViewsInRegion(BPrivate::PortLink& link,
BRegion& region, BRegion& region,
BRegion* windowContentClipping); BRegion* windowContentClipping);
+56 -58
View File
@@ -12,7 +12,6 @@
#include "Window.h" #include "Window.h"
#include "DebugInfoManager.h"
#include "Decorator.h" #include "Decorator.h"
#include "DecorManager.h" #include "DecorManager.h"
#include "Desktop.h" #include "Desktop.h"
@@ -38,16 +37,16 @@
// Toggle debug output // Toggle debug output
//#define DEBUG_WINDOW_LAYER //#define DEBUG_WINDOW
//#define DEBUG_WINDOW_LAYER_CLICK //#define DEBUG_WINDOW_CLICK
#ifdef DEBUG_WINDOW_LAYER #ifdef DEBUG_WINDOW
# define STRACE(x) printf x # define STRACE(x) printf x
#else #else
# define STRACE(x) ; # define STRACE(x) ;
#endif #endif
#ifdef DEBUG_WINDOW_LAYER_CLICK #ifdef DEBUG_WINDOW_CLICK
# define STRACE_CLICK(x) printf x # define STRACE_CLICK(x) printf x
#else #else
# define STRACE_CLICK(x) ; # define STRACE_CLICK(x) ;
@@ -100,7 +99,7 @@ Window::Window(const BRect& frame, const char *name,
fActivateOnMouseUp(false), fActivateOnMouseUp(false),
fDecorator(NULL), fDecorator(NULL),
fTopLayer(NULL), fTopView(NULL),
fWindow(window), fWindow(window),
fDrawingEngine(drawingEngine), fDrawingEngine(drawingEngine),
fDesktop(window->Desktop()), fDesktop(window->Desktop()),
@@ -161,7 +160,7 @@ Window::Window(const BRect& frame, const char *name,
fDesktop->ScreenAt(0)->GetMode(width, height, fDesktop->ScreenAt(0)->GetMode(width, height,
colorSpace, frequency); colorSpace, frequency);
// TODO: MOVE THIS AWAY!!! ResizeBy contains calls to virtual methods! // TODO: MOVE THIS AWAY!!! ResizeBy contains calls to virtual methods!
// Also, there is no TopLayer()! // Also, there is no TopView()!
fFrame.OffsetTo(B_ORIGIN); fFrame.OffsetTo(B_ORIGIN);
// ResizeBy(width - frame.Width(), height - frame.Height(), NULL); // ResizeBy(width - frame.Width(), height - frame.Height(), NULL);
} }
@@ -176,10 +175,10 @@ Window::Window(const BRect& frame, const char *name,
Window::~Window() Window::~Window()
{ {
if (fTopLayer) if (fTopView)
fTopLayer->DetachedFromWindow(); fTopView->DetachedFromWindow();
delete fTopLayer; delete fTopView;
delete fDecorator; delete fDecorator;
} }
@@ -307,9 +306,9 @@ Window::MoveBy(int32 x, int32 y)
if (fDecorator) if (fDecorator)
fDecorator->MoveBy(x, y); fDecorator->MoveBy(x, y);
if (fTopLayer != NULL) { if (fTopView != NULL) {
fTopLayer->MoveBy(x, y, NULL); fTopView->MoveBy(x, y, NULL);
fTopLayer->UpdateOverlay(); fTopView->UpdateOverlay();
} }
// the desktop will take care of dirty regions // the desktop will take care of dirty regions
@@ -366,9 +365,9 @@ Window::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion)
//} //}
} }
if (fTopLayer != NULL) { if (fTopView != NULL) {
fTopLayer->ResizeBy(x, y, dirtyRegion); fTopView->ResizeBy(x, y, dirtyRegion);
fTopLayer->UpdateOverlay(); fTopView->UpdateOverlay();
} }
//if (dirtyRegion) //if (dirtyRegion)
@@ -390,7 +389,7 @@ Window::ScrollViewBy(View* view, int32 dx, int32 dy)
// this is executed in ServerWindow with the Readlock // this is executed in ServerWindow with the Readlock
// held // held
if (!view || view == fTopLayer || (dx == 0 && dy == 0)) if (!view || view == fTopView || (dx == 0 && dy == 0))
return; return;
BRegion* dirty = fRegionPool.GetRegion(); BRegion* dirty = fRegionPool.GetRegion();
@@ -485,26 +484,26 @@ Window::CopyContents(BRegion* region, int32 xOffset, int32 yOffset)
void void
Window::SetTopLayer(View* topLayer) Window::SetTopView(View* topView)
{ {
fTopLayer = topLayer; fTopView = topView;
if (fTopLayer) { if (fTopView) {
// the top layer is special, it has a coordinate system // the top view is special, it has a coordinate system
// as if it was attached directly to the desktop, therefor, // as if it was attached directly to the desktop, therefor,
// the coordinate conversion through the layer tree works // the coordinate conversion through the view tree works
// as expected, since the top layer has no "parent" but has // as expected, since the top view has no "parent" but has
// fFrame as if it had // fFrame as if it had
// make sure the location of the top layer on screen matches ours // make sure the location of the top view on screen matches ours
fTopLayer->MoveBy(fFrame.left - fTopLayer->Frame().left, fTopView->MoveBy(fFrame.left - fTopView->Frame().left,
fFrame.top - fTopLayer->Frame().top, NULL); fFrame.top - fTopView->Frame().top, NULL);
// make sure the size of the top layer matches ours // make sure the size of the top view matches ours
fTopLayer->ResizeBy(fFrame.Width() - fTopLayer->Frame().Width(), fTopView->ResizeBy(fFrame.Width() - fTopView->Frame().Width(),
fFrame.Height() - fTopLayer->Frame().Height(), NULL); fFrame.Height() - fTopView->Frame().Height(), NULL);
fTopLayer->AttachedToWindow(this); fTopView->AttachedToWindow(this);
} }
} }
@@ -512,7 +511,7 @@ Window::SetTopLayer(View* topLayer)
View* View*
Window::ViewAt(const BPoint& where) Window::ViewAt(const BPoint& where)
{ {
return fTopLayer->ViewAt(where); return fTopView->ViewAt(where);
} }
@@ -541,7 +540,7 @@ Window::PreviousWindow(int32 index) const
void void
Window::GetEffectiveDrawingRegion(View* layer, BRegion& region) Window::GetEffectiveDrawingRegion(View* view, BRegion& region)
{ {
if (!fEffectiveDrawingRegionValid) { if (!fEffectiveDrawingRegionValid) {
fEffectiveDrawingRegion = VisibleContentRegion(); fEffectiveDrawingRegion = VisibleContentRegion();
@@ -554,29 +553,29 @@ Window::GetEffectiveDrawingRegion(View* layer, BRegion& region)
fEffectiveDrawingRegion.IntersectWith(&fCurrentUpdateSession->DirtyRegion()); fEffectiveDrawingRegion.IntersectWith(&fCurrentUpdateSession->DirtyRegion());
} else { } else {
// not in update, the view can draw everywhere // not in update, the view can draw everywhere
//printf("Window(%s)::GetEffectiveDrawingRegion(for %s) - outside update\n", Title(), layer->Name()); //printf("Window(%s)::GetEffectiveDrawingRegion(for %s) - outside update\n", Title(), view->Name());
} }
fEffectiveDrawingRegionValid = true; fEffectiveDrawingRegionValid = true;
} }
// TODO: this is a region that needs to be cached later in the server // TODO: this is a region that needs to be cached later in the server
// when the current layer in ServerWindow is set, and we are currently // when the current view in ServerWindow is set, and we are currently
// in an update (fInUpdate), than we can set this region and remember // in an update (fInUpdate), than we can set this region and remember
// it for the comming drawing commands until the current layer changes // it for the comming drawing commands until the current view changes
// again or fEffectiveDrawingRegionValid is suddenly false. // again or fEffectiveDrawingRegionValid is suddenly false.
region = fEffectiveDrawingRegion; region = fEffectiveDrawingRegion;
if (!fContentRegionValid) if (!fContentRegionValid)
_UpdateContentRegion(); _UpdateContentRegion();
region.IntersectWith(&layer->ScreenClipping(&fContentRegion)); region.IntersectWith(&view->ScreenClipping(&fContentRegion));
} }
bool bool
Window::DrawingRegionChanged(View* layer) const Window::DrawingRegionChanged(View* view) const
{ {
return !fEffectiveDrawingRegionValid || !layer->IsScreenClippingValid(); return !fEffectiveDrawingRegionValid || !view->IsScreenClippingValid();
} }
@@ -685,22 +684,21 @@ Window::MarkContentDirtyAsync(BRegion& regionOnScreen)
void void
Window::InvalidateView(View* layer, BRegion& layerRegion) Window::InvalidateView(View* view, BRegion& viewRegion)
{ {
if (layer && IsVisible() && layer->IsVisible()) { if (view && IsVisible() && view->IsVisible()) {
if (!fContentRegionValid) if (!fContentRegionValid)
_UpdateContentRegion(); _UpdateContentRegion();
layer->ConvertToScreen(&layerRegion); view->ConvertToScreen(&viewRegion);
layerRegion.IntersectWith(&VisibleContentRegion()); viewRegion.IntersectWith(&VisibleContentRegion());
if (layerRegion.CountRects() > 0) { if (viewRegion.CountRects() > 0) {
layerRegion.IntersectWith(&layer->ScreenClipping(&fContentRegion)); viewRegion.IntersectWith(&view->ScreenClipping(&fContentRegion));
//fDrawingEngine->FillRegion(layerRegion, rgb_color{ 0, 255, 0, 255 }); //fDrawingEngine->FillRegion(viewRegion, rgb_color{ 0, 255, 0, 255 });
//snooze(10000); //snooze(10000);
fDirtyCause |= UPDATE_REQUEST; fDirtyCause |= UPDATE_REQUEST;
_TriggerContentRedraw(layerRegion); _TriggerContentRedraw(viewRegion);
} }
} }
} }
@@ -939,12 +937,12 @@ Window::MouseMoved(BMessage *message, BPoint where, int32* _viewToken,
bool isLatestMouseMoved) bool isLatestMouseMoved)
{ {
#if 0 #if 0
if (fDecorator != NULL && fTopLayer != NULL) { if (fDecorator != NULL && fTopView != NULL) {
DrawingEngine* engine = fDecorator->GetDrawingEngine(); DrawingEngine* engine = fDecorator->GetDrawingEngine();
engine->LockParallelAccess(); engine->LockParallelAccess();
engine->ConstrainClippingRegion(&VisibleRegion()); engine->ConstrainClippingRegion(&VisibleRegion());
fTopLayer->MarkAt(engine, where); fTopView->MarkAt(engine, where);
engine->UnlockParallelAccess(); engine->UnlockParallelAccess();
} }
#endif #endif
@@ -1160,7 +1158,7 @@ Window::SetHidden(bool hidden)
if (fHidden != hidden) { if (fHidden != hidden) {
fHidden = hidden; fHidden = hidden;
fTopLayer->SetHidden(hidden); fTopView->SetHidden(hidden);
// TODO: anything else? // TODO: anything else?
} }
@@ -1534,7 +1532,7 @@ void
Window::FindWorkspacesViews(BObjectList<WorkspacesView>& list) const Window::FindWorkspacesViews(BObjectList<WorkspacesView>& list) const
{ {
int32 count = fWorkspacesViewCount; int32 count = fWorkspacesViewCount;
fTopLayer->FindViews(kWorkspacesViewFlag, (BObjectList<View>&)list, count); fTopView->FindViews(kWorkspacesViewFlag, (BObjectList<View>&)list, count);
} }
@@ -1680,9 +1678,9 @@ Window::ValidWindowFlags(window_feel feel)
} }
// #pragma mark - private // #pragma mark - private
// _ShiftPartOfRegion // _ShiftPartOfRegion
void void
Window::_ShiftPartOfRegion(BRegion* region, BRegion* regionToShift, Window::_ShiftPartOfRegion(BRegion* region, BRegion* regionToShift,
@@ -1723,13 +1721,14 @@ Window::_TriggerContentRedraw(BRegion& dirtyContentRegion)
// there was suddenly added a dirty region // there was suddenly added a dirty region
// caused by exposing content, we need to clear // caused by exposing content, we need to clear
// the entire background // the entire background
backgroundClearingRegion = &(fPendingUpdateSession->DirtyRegion()); backgroundClearingRegion
= &(fPendingUpdateSession->DirtyRegion());
} }
if (fDrawingEngine->LockParallelAccess()) { if (fDrawingEngine->LockParallelAccess()) {
fDrawingEngine->SuspendAutoSync(); fDrawingEngine->SuspendAutoSync();
fTopLayer->Draw(fDrawingEngine, backgroundClearingRegion, fTopView->Draw(fDrawingEngine, backgroundClearingRegion,
&fContentRegion, true); &fContentRegion, true);
fDrawingEngine->Sync(); fDrawingEngine->Sync();
@@ -1806,7 +1805,7 @@ Window::_TransferToUpdateSession(BRegion* contentDirtyRegion)
// clip pending update session from current // clip pending update session from current
// update session, it makes no sense to draw stuff // update session, it makes no sense to draw stuff
// already needing a redraw anyways. Theoretically, // already needing a redraw anyways. Theoretically,
// this could be done smarter (clip layers from pending // this could be done smarter (clip views from pending
// that have not yet been redrawn in the current update // that have not yet been redrawn in the current update
// session) // session)
// NOTE: appearently the R5 app_server does not do that, it just // NOTE: appearently the R5 app_server does not do that, it just
@@ -1905,7 +1904,7 @@ Window::BeginUpdate(BPrivate::PortLink& link)
link.Attach<BRect>(dirty->Frame()); link.Attach<BRect>(dirty->Frame());
// find and attach all views that intersect with // find and attach all views that intersect with
// the dirty region // the dirty region
fTopLayer->AddTokensForLayersInRegion(link, *dirty, &fContentRegion); fTopView->AddTokensForViewsInRegion(link, *dirty, &fContentRegion);
// mark the end of the token "list" // mark the end of the token "list"
link.Attach<int32>(B_NULL_TOKEN); link.Attach<int32>(B_NULL_TOKEN);
link.Flush(); link.Flush();
@@ -1914,8 +1913,7 @@ Window::BeginUpdate(BPrivate::PortLink& link)
//fDrawingEngine->FillRegion(dirty, (rgb_color){ 255, 0, 0, 255 }); //fDrawingEngine->FillRegion(dirty, (rgb_color){ 255, 0, 0, 255 });
fDrawingEngine->SuspendAutoSync(); fDrawingEngine->SuspendAutoSync();
fTopLayer->Draw(fDrawingEngine, dirty, fTopView->Draw(fDrawingEngine, dirty, &fContentRegion, true);
&fContentRegion, true);
fDrawingEngine->Sync(); fDrawingEngine->Sync();
fDrawingEngine->UnlockParallelAccess(); fDrawingEngine->UnlockParallelAccess();
+6 -6
View File
@@ -80,14 +80,14 @@ public:
void ScrollViewBy(View* view, int32 dx, int32 dy); void ScrollViewBy(View* view, int32 dx, int32 dy);
void SetTopLayer(View* topLayer); void SetTopView(View* topView);
View* TopLayer() const { return fTopLayer; } View* TopView() const { return fTopView; }
View* ViewAt(const BPoint& where); View* ViewAt(const BPoint& where);
virtual bool IsOffscreenWindow() const { return false; } virtual bool IsOffscreenWindow() const { return false; }
void GetEffectiveDrawingRegion(View* layer, BRegion& region); void GetEffectiveDrawingRegion(View* view, BRegion& region);
bool DrawingRegionChanged(View* layer) const; bool DrawingRegionChanged(View* view) const;
// generic version, used by the Desktop // generic version, used by the Desktop
void ProcessDirtyRegion(BRegion& regionOnScreen); void ProcessDirtyRegion(BRegion& regionOnScreen);
@@ -100,7 +100,7 @@ public:
void MarkContentDirty(BRegion& regionOnScreen); void MarkContentDirty(BRegion& regionOnScreen);
void MarkContentDirtyAsync(BRegion& regionOnScreen); void MarkContentDirtyAsync(BRegion& regionOnScreen);
// shortcut for invalidating just one view // shortcut for invalidating just one view
void InvalidateView(View* view, BRegion& layerRegion); void InvalidateView(View* view, BRegion& viewRegion);
void DisableUpdateRequests(); void DisableUpdateRequests();
void EnableUpdateRequests(); void EnableUpdateRequests();
@@ -292,7 +292,7 @@ protected:
bool fActivateOnMouseUp : 1; bool fActivateOnMouseUp : 1;
::Decorator* fDecorator; ::Decorator* fDecorator;
View* fTopLayer; View* fTopView;
::ServerWindow* fWindow; ::ServerWindow* fWindow;
DrawingEngine* fDrawingEngine; DrawingEngine* fDrawingEngine;
::Desktop* fDesktop; ::Desktop* fDesktop;
+1 -1
View File
@@ -83,7 +83,7 @@ Workspace::Workspace(Desktop& desktop, int32 index)
// fDesktop.LockSingleWindow(); // fDesktop.LockSingleWindow();
// TODO: in which threads is this being used? // TODO: in which threads is this being used?
// from my investigations, it is used in the // from my investigations, it is used in the
// WorkspacesLayer::Draw(), which would have // WorkspacesView::Draw(), which would have
// to hold the read lock already // to hold the read lock already
RewindWindows(); RewindWindows();
} }
+1 -1
View File
@@ -86,7 +86,7 @@ WorkspacesView::_ScreenFrame(int32 i)
/*! /*!
\brief Returns the frame of the specified workspace within the \brief Returns the frame of the specified workspace within the
workspaces layer. workspaces view.
*/ */
BRect BRect
WorkspacesView::_WorkspaceAt(int32 i) WorkspacesView::_WorkspaceAt(int32 i)
+5 -6
View File
@@ -95,7 +95,6 @@ AddResources haiku_app_server : app_server.rdef ;
Server haiku_app_server : Server haiku_app_server :
# Misc. Sources # Misc. Sources
Decorator.cpp Decorator.cpp
DebugInfoManager.cpp
ProfileMessageSupport.cpp ProfileMessageSupport.cpp
EventDispatcher.cpp EventDispatcher.cpp
EventStream.cpp EventStream.cpp
@@ -128,15 +127,15 @@ Server haiku_app_server :
BitmapHWInterface.cpp BitmapHWInterface.cpp
DefaultDecorator.cpp DefaultDecorator.cpp
OffscreenServerWindow.cpp OffscreenServerWindow.cpp
OffscreenWindowLayer.cpp OffscreenWindow.cpp
RegionPool.cpp RegionPool.cpp
Screen.cpp
ServerPicture.cpp ServerPicture.cpp
ServerScreen.cpp View.cpp
ViewLayer.cpp Window.cpp
WindowLayer.cpp
WindowList.cpp WindowList.cpp
Workspace.cpp Workspace.cpp
WorkspacesLayer.cpp WorkspacesView.cpp
# libraries # libraries
: :