* 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
+4 -4
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2001-2006, Haiku.
* Copyright 2001-2008, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -7,7 +7,7 @@
* 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"
@@ -464,7 +464,7 @@ DefaultDecorator::GetFootprint(BRegion *region)
{
STRACE(("DefaultDecorator: Get Footprint\n"));
// 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.
if (!region)
return;
@@ -487,7 +487,7 @@ DefaultDecorator::GetFootprint(BRegion *region)
if (fLook == B_DOCUMENT_WINDOW_LOOK) {
// include the rectangular resize knob on the bottom right
region->Include(BRect(fFrame.right - 13.0f, fFrame.bottom - 13.0f,
fFrame.right, fFrame.bottom));
fFrame.right, fFrame.bottom));
}
}
+3 -3
View File
@@ -244,7 +244,7 @@ MouseFilter::Filter(BMessage* message, EventTarget** _target, int32* _viewToken,
window = fDesktop->WindowAt(where);
if (window != NULL) {
// dispatch event in the window layers
// dispatch event to the window
switch (message->what) {
case B_MOUSE_DOWN:
window->MouseDown(message, where, &viewToken);
@@ -758,7 +758,7 @@ Desktop::RedrawBackground()
// look for desktop background view, and update its background color
// TODO: is there a better way to do this?
View* view = window->TopLayer();
View* view = window->TopView();
if (view != NULL)
view = view->FirstChild();
@@ -1661,7 +1661,7 @@ Desktop::ShowWindow(Window* window)
}
if (window->HasWorkspacesViews()) {
// find workspaces layer in view hierarchy
// find workspaces views in view hierarchy
window->FindWorkspacesViews(fWorkspacesViews);
}
+1 -1
View File
@@ -162,7 +162,7 @@ class DrawState {
bool fFontAliasing;
// 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",
// I never knew what it does on R5, but I can use
// it in Painter to actually draw stuff with
-1
View File
@@ -17,7 +17,6 @@ Server app_server :
CursorData.cpp
CursorManager.cpp
CursorSet.cpp
DebugInfoManager.cpp
DecorManager.cpp
Decorator.cpp
DefaultDecorator.cpp
+1 -2
View File
@@ -14,7 +14,6 @@
#include <Debug.h>
#include "BitmapHWInterface.h"
#include "DebugInfoManager.h"
#include "DrawingEngine.h"
#include "ServerBitmap.h"
@@ -41,7 +40,7 @@ OffscreenWindow::OffscreenWindow(ServerBitmap* bitmap,
OffscreenWindow::~OffscreenWindow()
{
fHWInterface->LockExclusiveAccess();
// Unlike normal Layers, we own the DrawingEngine instance
// Unlike normal windows, we own the DrawingEngine instance
delete GetDrawingEngine();
fHWInterface->Shutdown();
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.
*
* 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_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_SET_FLAGS: string = "AS_LAYER_SET_FLAGS"; break;
case AS_LAYER_SET_ORIGIN: string = "AS_LAYER_SET_ORIGIN"; break;
+1 -4
View File
@@ -21,7 +21,6 @@
#include "CursorManager.h"
#include "CursorSet.h"
#include "Desktop.h"
#include "DebugInfoManager.h"
#include "DecorManager.h"
#include "DrawingEngine.h"
#include "EventStream.h"
@@ -132,9 +131,7 @@ ServerApp::ServerApp(Desktop* desktop, port_id clientReplyPort,
ServerApp::~ServerApp()
{
STRACE(("*ServerApp %s:~ServerApp()\n", Signature()));
if (!fQuitting)
CRITICAL("ServerApp: destructor called after Run()!\n");
ASSERT(fQuitting);
// quit all server windows
+28 -31
View File
@@ -24,7 +24,6 @@
#include "ServerWindow.h"
#include "AppServer.h"
#include "DebugInfoManager.h"
#include "Desktop.h"
#include "DrawingEngine.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
ServerWindow::ReplaceDecorator()
{
@@ -557,28 +556,28 @@ ServerWindow::_CreateView(BPrivate::LinkReceiver &link, View **_parent)
link.Read<rgb_color>(&viewColor);
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));
View* newLayer;
View* newView;
if ((flags & kWorkspacesViewFlag) != 0) {
newLayer = new (nothrow) WorkspacesView(frame, scrollingOffset, name,
newView = new (nothrow) WorkspacesView(frame, scrollingOffset, name,
token, resizeMask, flags);
} else {
newLayer = new (nothrow) View(frame, scrollingOffset, name, token,
newView = new (nothrow) View(frame, scrollingOffset, name, token,
resizeMask, flags);
}
free(name);
if (newLayer == NULL)
if (newView == NULL)
return NULL;
// there is no way of setting this, other than manually :-)
newLayer->SetViewColor(viewColor);
newLayer->SetHidden(hidden);
newLayer->SetEventMask(eventMask, eventOptions);
newView->SetViewColor(viewColor);
newView->SetHidden(hidden);
newView->SetEventMask(eventMask, eventOptions);
if (eventMask != 0 || eventOptions != 0) {
// fDesktop->UnlockSingleWindow();
@@ -586,7 +585,7 @@ ServerWindow::_CreateView(BPrivate::LinkReceiver &link, View **_parent)
fDesktop->UnlockAllWindows();
// TODO: possible deadlock
fDesktop->EventDispatcher().AddListener(EventTarget(),
newLayer->Token(), eventMask, eventOptions);
newView->Token(), eventMask, eventOptions);
fDesktop->LockAllWindows();
// fDesktop->UnlockAllWindows();
// fDesktop->LockSingleWindow();
@@ -596,27 +595,27 @@ fDesktop->LockAllWindows();
DesktopSettings settings(fDesktop);
ServerFont font;
settings.GetDefaultPlainFont(font);
newLayer->CurrentState()->SetFont(font);
newView->CurrentState()->SetFont(font);
if (_parent) {
View *parent;
if (App()->ViewTokens().GetToken(parentToken, B_HANDLER_TOKEN,
(void**)&parent) != B_OK
|| parent->Window()->ServerWindow() != this) {
CRITICAL("View token not found!\n");
debug_printf("View token not found!\n");
parent = NULL;
}
*_parent = parent;
}
return newLayer;
return newView;
}
/*!
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
ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
@@ -1127,7 +1126,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
(void**)&current) != B_OK
|| current->Window()->ServerWindow() != this) {
// 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;
} else {
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));
fWindow->SetTopLayer(fCurrentView);
fWindow->SetTopView(fCurrentView);
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()));
View* parent = NULL;
View* newLayer = _CreateView(link, &parent);
if (parent != NULL && newLayer != NULL)
parent->AddChild(newLayer);
View* newView = _CreateView(link, &parent);
if (parent != NULL && newView != NULL)
parent->AddChild(newView);
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;
}
@@ -2890,9 +2889,7 @@ ServerWindow::_MessageLooper()
quitLoop = true;
// ServerWindow's destructor takes care of pulling this object off the desktop.
if (!fWindow->IsHidden())
CRITICAL("ServerWindow: a window must be hidden before it's deleted\n");
ASSERT(fWindow->IsHidden());
break;
}
@@ -3132,12 +3129,12 @@ ServerWindow::HandleDirectConnection(int32 bufferState, int32 driverState)
void
ServerWindow::_SetCurrentView(View* layer)
ServerWindow::_SetCurrentView(View* view)
{
if (fCurrentView == layer)
if (fCurrentView == view)
return;
fCurrentView = layer;
fCurrentView = view;
fCurrentDrawingRegionValid = false;
_UpdateDrawState(fCurrentView);
@@ -3166,17 +3163,17 @@ ServerWindow::_SetCurrentView(View* layer)
void
ServerWindow::_UpdateDrawState(View* layer)
ServerWindow::_UpdateDrawState(View* view)
{
// 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 = fWindow->GetDrawingEngine();
if (layer && drawingEngine) {
if (view && drawingEngine) {
BPoint p(0, 0);
layer->ConvertToScreenForDrawing(&p);
drawingEngine->SetDrawState(layer->CurrentState(), p.x, p.y);
view->ConvertToScreenForDrawing(&p);
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),
fFlags(flags),
// ViewLayers start visible by default
// Views start visible by default
fHidden(false),
fVisible(true),
fBackgroundDirty(true),
@@ -123,17 +123,17 @@ View::~View()
delete fDrawState;
// if (fWindow && this == fWindow->TopLayer())
// fWindow->SetTopLayer(NULL);
// if (fWindow && this == fWindow->TopView())
// fWindow->SetTopView(NULL);
if (fCursor)
fCursor->Release();
// iterate over children and delete each one
View* layer = fFirstChild;
while (layer) {
View* toast = layer;
layer = layer->fNextSibling;
View* view = fFirstChild;
while (view) {
View* toast = view;
view = view->fNextSibling;
delete toast;
}
}
@@ -167,7 +167,7 @@ View::AttachedToWindow(::Window* window)
fWindow = window;
// an ugly hack to detect the desktop background
if (window->Feel() == kDesktopWindowFeel && Parent() == TopLayer())
if (window->Feel() == kDesktopWindowFeel && Parent() == TopView())
fIsDesktopBackground = true;
// insert view into local token space
@@ -200,36 +200,36 @@ View::DetachedFromWindow()
void
View::AddChild(View* layer)
View::AddChild(View* view)
{
if (layer->fParent) {
if (view->fParent) {
printf("View::AddChild() - View already has a parent\n");
return;
}
layer->fParent = this;
view->fParent = this;
if (!fLastChild) {
// no children yet
fFirstChild = layer;
fFirstChild = view;
} else {
// append layer to formerly last child
fLastChild->fNextSibling = layer;
layer->fPreviousSibling = fLastChild;
// append view to formerly last child
fLastChild->fNextSibling = view;
view->fPreviousSibling = fLastChild;
}
fLastChild = layer;
fLastChild = view;
layer->UpdateVisibleDeep(fVisible);
view->UpdateVisibleDeep(fVisible);
if (layer->IsVisible())
if (view->IsVisible())
RebuildClipping(false);
if (fWindow) {
layer->AttachedToWindow(fWindow);
view->AttachedToWindow(fWindow);
if (layer->IsVisible()) {
if (view->IsVisible()) {
// trigger redraw
IntRect clippedFrame = layer->Frame();
IntRect clippedFrame = view->Frame();
ConvertToVisibleInTopView(&clippedFrame);
BRegion* dirty = fWindow->GetRegion();
if (dirty) {
@@ -243,37 +243,37 @@ View::AddChild(View* layer)
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 "
"this (%p) layer!\n", layer, layer ? layer->Name() : NULL, this);
"this (%p) view!\n", view, view ? view->Name() : NULL, this);
return false;
}
layer->fParent = NULL;
view->fParent = NULL;
if (fLastChild == layer)
fLastChild = layer->fPreviousSibling;
// layer->fNextSibling would be NULL
if (fLastChild == view)
fLastChild = view->fPreviousSibling;
// view->fNextSibling would be NULL
if (fFirstChild == layer )
fFirstChild = layer->fNextSibling;
// layer->fPreviousSibling would be NULL
if (fFirstChild == view )
fFirstChild = view->fNextSibling;
// view->fPreviousSibling would be NULL
// connect child before and after layer
if (layer->fPreviousSibling)
layer->fPreviousSibling->fNextSibling = layer->fNextSibling;
// connect child before and after view
if (view->fPreviousSibling)
view->fPreviousSibling->fNextSibling = view->fNextSibling;
if (layer->fNextSibling)
layer->fNextSibling->fPreviousSibling = layer->fPreviousSibling;
if (view->fNextSibling)
view->fNextSibling->fPreviousSibling = view->fPreviousSibling;
// layer has no siblings anymore
layer->fPreviousSibling = NULL;
layer->fNextSibling = NULL;
// view has no siblings anymore
view->fPreviousSibling = NULL;
view->fNextSibling = NULL;
if (layer->IsVisible()) {
Overlay* overlay = layer->_Overlay();
if (view->IsVisible()) {
Overlay* overlay = view->_Overlay();
if (overlay != NULL)
overlay->Hide();
@@ -281,11 +281,11 @@ View::RemoveChild(View* layer)
}
if (fWindow) {
layer->DetachedFromWindow();
view->DetachedFromWindow();
if (fVisible && layer->IsVisible()) {
if (fVisible && view->IsVisible()) {
// trigger redraw
IntRect clippedFrame = layer->Frame();
IntRect clippedFrame = view->Frame();
ConvertToVisibleInTopView(&clippedFrame);
BRegion* dirty = fWindow->GetRegion();
if (dirty) {
@@ -301,13 +301,13 @@ View::RemoveChild(View* layer)
View*
View::TopLayer()
View::TopView()
{
// returns the top level view of the hirarchy,
// it doesn't have to be the top level of a window
if (fParent)
return fParent->TopLayer();
return fParent->TopView();
return this;
}
@@ -407,9 +407,9 @@ View::ViewAt(const BPoint& where)
return NULL;
for (View* child = FirstChild(); child; child = child->NextSibling()) {
View* layer = child->ViewAt(where);
if (layer != NULL)
return layer;
View* view = child->ViewAt(where);
if (view != NULL)
return view;
}
return this;
@@ -1469,7 +1469,7 @@ View::MarkBackgroundDirty()
void
View::AddTokensForLayersInRegion(BMessage* message, BRegion& region,
View::AddTokensForViewsInRegion(BMessage* message, BRegion& region,
BRegion* windowContentClipping)
{
if (!fVisible)
@@ -1479,14 +1479,14 @@ View::AddTokensForLayersInRegion(BMessage* message, BRegion& region,
message->AddInt32("_token", fToken);
for (View* child = FirstChild(); child; child = child->NextSibling()) {
child->AddTokensForLayersInRegion(message, region,
child->AddTokensForViewsInRegion(message, region,
windowContentClipping);
}
}
void
View::AddTokensForLayersInRegion(BPrivate::PortLink& link, BRegion& region,
View::AddTokensForViewsInRegion(BPrivate::PortLink& link, BRegion& region,
BRegion* windowContentClipping)
{
if (!fVisible)
@@ -1501,7 +1501,7 @@ View::AddTokensForLayersInRegion(BPrivate::PortLink& link, BRegion& region,
link.Attach<int32>(fToken);
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;
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
// clips to each views bounds
@@ -81,8 +81,8 @@ class View {
::Window* Window() const { return fWindow; }
// tree stuff
void AddChild(View* layer);
bool RemoveChild(View* layer);
void AddChild(View* view);
bool RemoveChild(View* view);
inline View* Parent() const
{ return fParent; }
@@ -96,7 +96,7 @@ class View {
inline View* NextSibling() const
{ return fNextSibling; }
View* TopLayer();
View* TopView();
uint32 CountChildren(bool deep = false) const;
void CollectTokensForChildren(BList* tokenMap) const;
@@ -215,11 +215,11 @@ class View {
bool IsDesktopBackground() const
{ return fIsDesktopBackground; }
void AddTokensForLayersInRegion(BMessage* message,
void AddTokensForViewsInRegion(BMessage* message,
BRegion& region,
BRegion* windowContentClipping);
void AddTokensForLayersInRegion(BPrivate::PortLink& link,
void AddTokensForViewsInRegion(BPrivate::PortLink& link,
BRegion& region,
BRegion* windowContentClipping);
+57 -59
View File
@@ -12,7 +12,6 @@
#include "Window.h"
#include "DebugInfoManager.h"
#include "Decorator.h"
#include "DecorManager.h"
#include "Desktop.h"
@@ -38,16 +37,16 @@
// Toggle debug output
//#define DEBUG_WINDOW_LAYER
//#define DEBUG_WINDOW_LAYER_CLICK
//#define DEBUG_WINDOW
//#define DEBUG_WINDOW_CLICK
#ifdef DEBUG_WINDOW_LAYER
#ifdef DEBUG_WINDOW
# define STRACE(x) printf x
#else
# define STRACE(x) ;
#endif
#ifdef DEBUG_WINDOW_LAYER_CLICK
#ifdef DEBUG_WINDOW_CLICK
# define STRACE_CLICK(x) printf x
#else
# define STRACE_CLICK(x) ;
@@ -100,7 +99,7 @@ Window::Window(const BRect& frame, const char *name,
fActivateOnMouseUp(false),
fDecorator(NULL),
fTopLayer(NULL),
fTopView(NULL),
fWindow(window),
fDrawingEngine(drawingEngine),
fDesktop(window->Desktop()),
@@ -161,7 +160,7 @@ Window::Window(const BRect& frame, const char *name,
fDesktop->ScreenAt(0)->GetMode(width, height,
colorSpace, frequency);
// TODO: MOVE THIS AWAY!!! ResizeBy contains calls to virtual methods!
// Also, there is no TopLayer()!
// Also, there is no TopView()!
fFrame.OffsetTo(B_ORIGIN);
// ResizeBy(width - frame.Width(), height - frame.Height(), NULL);
}
@@ -176,10 +175,10 @@ Window::Window(const BRect& frame, const char *name,
Window::~Window()
{
if (fTopLayer)
fTopLayer->DetachedFromWindow();
if (fTopView)
fTopView->DetachedFromWindow();
delete fTopLayer;
delete fTopView;
delete fDecorator;
}
@@ -307,9 +306,9 @@ Window::MoveBy(int32 x, int32 y)
if (fDecorator)
fDecorator->MoveBy(x, y);
if (fTopLayer != NULL) {
fTopLayer->MoveBy(x, y, NULL);
fTopLayer->UpdateOverlay();
if (fTopView != NULL) {
fTopView->MoveBy(x, y, NULL);
fTopView->UpdateOverlay();
}
// the desktop will take care of dirty regions
@@ -366,9 +365,9 @@ Window::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion)
//}
}
if (fTopLayer != NULL) {
fTopLayer->ResizeBy(x, y, dirtyRegion);
fTopLayer->UpdateOverlay();
if (fTopView != NULL) {
fTopView->ResizeBy(x, y, dirtyRegion);
fTopView->UpdateOverlay();
}
//if (dirtyRegion)
@@ -390,7 +389,7 @@ Window::ScrollViewBy(View* view, int32 dx, int32 dy)
// this is executed in ServerWindow with the Readlock
// held
if (!view || view == fTopLayer || (dx == 0 && dy == 0))
if (!view || view == fTopView || (dx == 0 && dy == 0))
return;
BRegion* dirty = fRegionPool.GetRegion();
@@ -485,26 +484,26 @@ Window::CopyContents(BRegion* region, int32 xOffset, int32 yOffset)
void
Window::SetTopLayer(View* topLayer)
Window::SetTopView(View* topView)
{
fTopLayer = topLayer;
fTopView = topView;
if (fTopLayer) {
// the top layer is special, it has a coordinate system
if (fTopView) {
// the top view is special, it has a coordinate system
// as if it was attached directly to the desktop, therefor,
// the coordinate conversion through the layer tree works
// as expected, since the top layer has no "parent" but has
// the coordinate conversion through the view tree works
// as expected, since the top view has no "parent" but has
// fFrame as if it had
// make sure the location of the top layer on screen matches ours
fTopLayer->MoveBy(fFrame.left - fTopLayer->Frame().left,
fFrame.top - fTopLayer->Frame().top, NULL);
// make sure the location of the top view on screen matches ours
fTopView->MoveBy(fFrame.left - fTopView->Frame().left,
fFrame.top - fTopView->Frame().top, NULL);
// make sure the size of the top layer matches ours
fTopLayer->ResizeBy(fFrame.Width() - fTopLayer->Frame().Width(),
fFrame.Height() - fTopLayer->Frame().Height(), NULL);
// make sure the size of the top view matches ours
fTopView->ResizeBy(fFrame.Width() - fTopView->Frame().Width(),
fFrame.Height() - fTopView->Frame().Height(), NULL);
fTopLayer->AttachedToWindow(this);
fTopView->AttachedToWindow(this);
}
}
@@ -512,7 +511,7 @@ Window::SetTopLayer(View* topLayer)
View*
Window::ViewAt(const BPoint& where)
{
return fTopLayer->ViewAt(where);
return fTopView->ViewAt(where);
}
@@ -541,7 +540,7 @@ Window::PreviousWindow(int32 index) const
void
Window::GetEffectiveDrawingRegion(View* layer, BRegion& region)
Window::GetEffectiveDrawingRegion(View* view, BRegion& region)
{
if (!fEffectiveDrawingRegionValid) {
fEffectiveDrawingRegion = VisibleContentRegion();
@@ -554,29 +553,29 @@ Window::GetEffectiveDrawingRegion(View* layer, BRegion& region)
fEffectiveDrawingRegion.IntersectWith(&fCurrentUpdateSession->DirtyRegion());
} else {
// 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;
}
// 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
// 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.
region = fEffectiveDrawingRegion;
if (!fContentRegionValid)
_UpdateContentRegion();
region.IntersectWith(&layer->ScreenClipping(&fContentRegion));
region.IntersectWith(&view->ScreenClipping(&fContentRegion));
}
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
Window::InvalidateView(View* layer, BRegion& layerRegion)
Window::InvalidateView(View* view, BRegion& viewRegion)
{
if (layer && IsVisible() && layer->IsVisible()) {
if (view && IsVisible() && view->IsVisible()) {
if (!fContentRegionValid)
_UpdateContentRegion();
layer->ConvertToScreen(&layerRegion);
layerRegion.IntersectWith(&VisibleContentRegion());
if (layerRegion.CountRects() > 0) {
layerRegion.IntersectWith(&layer->ScreenClipping(&fContentRegion));
view->ConvertToScreen(&viewRegion);
viewRegion.IntersectWith(&VisibleContentRegion());
if (viewRegion.CountRects() > 0) {
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);
fDirtyCause |= UPDATE_REQUEST;
_TriggerContentRedraw(layerRegion);
_TriggerContentRedraw(viewRegion);
}
}
}
@@ -939,12 +937,12 @@ Window::MouseMoved(BMessage *message, BPoint where, int32* _viewToken,
bool isLatestMouseMoved)
{
#if 0
if (fDecorator != NULL && fTopLayer != NULL) {
if (fDecorator != NULL && fTopView != NULL) {
DrawingEngine* engine = fDecorator->GetDrawingEngine();
engine->LockParallelAccess();
engine->ConstrainClippingRegion(&VisibleRegion());
fTopLayer->MarkAt(engine, where);
fTopView->MarkAt(engine, where);
engine->UnlockParallelAccess();
}
#endif
@@ -1160,7 +1158,7 @@ Window::SetHidden(bool hidden)
if (fHidden != hidden) {
fHidden = hidden;
fTopLayer->SetHidden(hidden);
fTopView->SetHidden(hidden);
// TODO: anything else?
}
@@ -1534,7 +1532,7 @@ void
Window::FindWorkspacesViews(BObjectList<WorkspacesView>& list) const
{
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
// _ShiftPartOfRegion
void
Window::_ShiftPartOfRegion(BRegion* region, BRegion* regionToShift,
@@ -1723,14 +1721,15 @@ Window::_TriggerContentRedraw(BRegion& dirtyContentRegion)
// there was suddenly added a dirty region
// caused by exposing content, we need to clear
// the entire background
backgroundClearingRegion = &(fPendingUpdateSession->DirtyRegion());
backgroundClearingRegion
= &(fPendingUpdateSession->DirtyRegion());
}
if (fDrawingEngine->LockParallelAccess()) {
fDrawingEngine->SuspendAutoSync();
fTopLayer->Draw(fDrawingEngine, backgroundClearingRegion,
&fContentRegion, true);
fTopView->Draw(fDrawingEngine, backgroundClearingRegion,
&fContentRegion, true);
fDrawingEngine->Sync();
fDrawingEngine->UnlockParallelAccess();
@@ -1806,7 +1805,7 @@ Window::_TransferToUpdateSession(BRegion* contentDirtyRegion)
// clip pending update session from current
// update session, it makes no sense to draw stuff
// 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
// session)
// 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());
// find and attach all views that intersect with
// the dirty region
fTopLayer->AddTokensForLayersInRegion(link, *dirty, &fContentRegion);
fTopView->AddTokensForViewsInRegion(link, *dirty, &fContentRegion);
// mark the end of the token "list"
link.Attach<int32>(B_NULL_TOKEN);
link.Flush();
@@ -1914,8 +1913,7 @@ Window::BeginUpdate(BPrivate::PortLink& link)
//fDrawingEngine->FillRegion(dirty, (rgb_color){ 255, 0, 0, 255 });
fDrawingEngine->SuspendAutoSync();
fTopLayer->Draw(fDrawingEngine, dirty,
&fContentRegion, true);
fTopView->Draw(fDrawingEngine, dirty, &fContentRegion, true);
fDrawingEngine->Sync();
fDrawingEngine->UnlockParallelAccess();
+6 -6
View File
@@ -80,14 +80,14 @@ public:
void ScrollViewBy(View* view, int32 dx, int32 dy);
void SetTopLayer(View* topLayer);
View* TopLayer() const { return fTopLayer; }
void SetTopView(View* topView);
View* TopView() const { return fTopView; }
View* ViewAt(const BPoint& where);
virtual bool IsOffscreenWindow() const { return false; }
void GetEffectiveDrawingRegion(View* layer, BRegion& region);
bool DrawingRegionChanged(View* layer) const;
void GetEffectiveDrawingRegion(View* view, BRegion& region);
bool DrawingRegionChanged(View* view) const;
// generic version, used by the Desktop
void ProcessDirtyRegion(BRegion& regionOnScreen);
@@ -100,7 +100,7 @@ public:
void MarkContentDirty(BRegion& regionOnScreen);
void MarkContentDirtyAsync(BRegion& regionOnScreen);
// shortcut for invalidating just one view
void InvalidateView(View* view, BRegion& layerRegion);
void InvalidateView(View* view, BRegion& viewRegion);
void DisableUpdateRequests();
void EnableUpdateRequests();
@@ -292,7 +292,7 @@ protected:
bool fActivateOnMouseUp : 1;
::Decorator* fDecorator;
View* fTopLayer;
View* fTopView;
::ServerWindow* fWindow;
DrawingEngine* fDrawingEngine;
::Desktop* fDesktop;
+1 -1
View File
@@ -83,7 +83,7 @@ Workspace::Workspace(Desktop& desktop, int32 index)
// fDesktop.LockSingleWindow();
// TODO: in which threads is this being used?
// from my investigations, it is used in the
// WorkspacesLayer::Draw(), which would have
// WorkspacesView::Draw(), which would have
// to hold the read lock already
RewindWindows();
}
+1 -1
View File
@@ -86,7 +86,7 @@ WorkspacesView::_ScreenFrame(int32 i)
/*!
\brief Returns the frame of the specified workspace within the
workspaces layer.
workspaces view.
*/
BRect
WorkspacesView::_WorkspaceAt(int32 i)
+5 -6
View File
@@ -95,7 +95,6 @@ AddResources haiku_app_server : app_server.rdef ;
Server haiku_app_server :
# Misc. Sources
Decorator.cpp
DebugInfoManager.cpp
ProfileMessageSupport.cpp
EventDispatcher.cpp
EventStream.cpp
@@ -128,15 +127,15 @@ Server haiku_app_server :
BitmapHWInterface.cpp
DefaultDecorator.cpp
OffscreenServerWindow.cpp
OffscreenWindowLayer.cpp
OffscreenWindow.cpp
RegionPool.cpp
Screen.cpp
ServerPicture.cpp
ServerScreen.cpp
ViewLayer.cpp
WindowLayer.cpp
View.cpp
Window.cpp
WindowList.cpp
Workspace.cpp
WorkspacesLayer.cpp
WorkspacesView.cpp
# libraries
: