fix scrolling of BViews that rely on app_server painting the background, remove a forgotten debug output in ViewLayer, reimplemented setting the window title during runtime, fix Decorator redraw on pressing buttons - though I was lazy on that one... it works, but as the TODOs say, it would be better integrated directly in the Decorator class than being handled by WindowLayer

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15429 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2005-12-08 22:15:12 +00:00
parent fcb6cbaa64
commit 939fb4077c
6 changed files with 82 additions and 30 deletions
+24
View File
@@ -1209,6 +1209,7 @@ Desktop::RemoveWindow(WindowLayer *window)
BAutolock _(this);
fAllWindows.RemoveWindow(window);
// _CurrentWindows().RemoveWindow(window);
_ChangeWindowWorkspaces(window, window->Workspaces(), 0);
// make sure this window won't get any events anymore
@@ -1283,9 +1284,32 @@ Desktop::SetWindowFlags(WindowLayer *window, uint32 newFlags)
}
void
Desktop::SetWindowTitle(WindowLayer *window, const char* title)
{
if (!WriteLockWindows())
return;
BRegion dirty;
window->SetTitle(title, dirty);
if (window->IsVisible() && dirty.CountRects() > 0) {
BRegion stillAvailableOnScreen;
_RebuildClippingForAllWindows(stillAvailableOnScreen);
_SetBackground(stillAvailableOnScreen);
_TriggerWindowRedrawing(dirty);
}
WriteUnlockWindows();
}
WindowLayer*
Desktop::WindowAt(BPoint where)
{
// TODO: BAutolock locker(this); ?!?
for (WindowLayer* window = _CurrentWindows().LastWindow(); window;
window = window->PreviousWindow(fCurrentWorkspace)) {
if (window->VisibleRegion().Contains(where))
+1
View File
@@ -114,6 +114,7 @@ class Desktop : public MessageLooper, public ScreenOwner {
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);
WindowLayer* FocusWindow() const { return fFocus; }
WindowLayer* FrontWindow() const { return fFront; }
+1 -1
View File
@@ -358,7 +358,7 @@ ServerWindow::SetTitle(const char* newTitle)
}
if (fWindowLayer != NULL)
fWindowLayer->SetTitle(newTitle);
fDesktop->SetWindowTitle(fWindowLayer, newTitle);
}
-1
View File
@@ -746,7 +746,6 @@ ViewLayer::ScrollBy(int32 x, int32 y, BRegion* dirtyRegion)
void
ViewLayer::CopyBits(BRect src, BRect dst, BRegion& windowContentClipping)
{
printf("ViewLayer(%s)::CopyBits()\n", Name());
if (!fVisible || !fWindow)
return;
+55 -27
View File
@@ -502,7 +502,7 @@ WindowLayer::ScrollViewBy(ViewLayer* view, int32 dx, int32 dy)
BRegion dirty;
view->ScrollBy(dx, dy, &dirty);
_MarkContentDirty(&dirty);
MarkContentDirty(dirty);
fDesktop->ReadUnlockWindows();
}
@@ -531,10 +531,7 @@ WindowLayer::CopyContents(BRegion* region, int32 xOffset, int32 yOffset)
// the part which we can copy is not dirty
newDirty.Exclude(region);
if (fDrawingEngine->Lock()) {
fDrawingEngine->CopyRegion(region, xOffset, yOffset);
fDrawingEngine->Unlock();
}
fDrawingEngine->CopyRegion(region, xOffset, yOffset);
// move along the already dirty regions that are common
// with the region that we could copy
@@ -845,6 +842,24 @@ WindowLayer::MouseDown(BMessage* msg, BPoint where, int32* _viewToken)
break;
}
// redraw decoratpr
BRegion visibleBorder;
GetBorderRegion(&visibleBorder);
visibleBorder.IntersectWith(&VisibleRegion());
fDrawingEngine->Lock();
fDrawingEngine->ConstrainClippingRegion(&visibleBorder);
if (fIsZooming) {
fDecorator->SetZoom(true);
} else if (fIsClosing) {
fDecorator->SetClose(true);
} else if (fIsMinimizing) {
fDecorator->SetMinimize(true);
}
fDrawingEngine->Unlock();
// based on what the Decorator returned, properly place this window.
if (action == DEC_MOVETOBACK) {
fDesktop->SendWindowBehind(this);
@@ -884,11 +899,23 @@ WindowLayer::MouseUp(BMessage* msg, BPoint where, int32* _viewToken)
bool invalidate = false;
if (fDecorator) {
click_type action = _ActionFor(msg);
// TODO: present behavior is not fine!
// Decorator's Set*() methods _actualy draw_! on screen, not
// taking into account if that region is visible or not!
// Decorator redraw code should follow the same path as Layer's
// one!
// redraw decoratpr
BRegion visibleBorder;
GetBorderRegion(&visibleBorder);
visibleBorder.IntersectWith(&VisibleRegion());
fDrawingEngine->Lock();
fDrawingEngine->ConstrainClippingRegion(&visibleBorder);
if (fIsZooming) {
fDecorator->SetZoom(true);
} else if (fIsClosing) {
fDecorator->SetClose(true);
} else if (fIsMinimizing) {
fDecorator->SetMinimize(true);
}
if (fIsZooming) {
fIsZooming = false;
fDecorator->SetZoom(false);
@@ -913,6 +940,8 @@ WindowLayer::MouseUp(BMessage* msg, BPoint where, int32* _viewToken)
fWindow->NotifyMinimize(true);
}
}
fDrawingEngine->Unlock();
}
fIsDragging = false;
fIsResizing = false;
@@ -927,11 +956,14 @@ void
WindowLayer::MouseMoved(BMessage *msg, BPoint where, int32* _viewToken)
{
if (fDecorator) {
// TODO: present behavior is not fine!
// Decorator's Set*() methods _actualy draw_! on screen, not
// taking into account if that region is visible or not!
// Decorator redraw code should follow the same path as Layer's
// one!
BRegion visibleBorder;
GetBorderRegion(&visibleBorder);
visibleBorder.IntersectWith(&VisibleRegion());
fDrawingEngine->Lock();
fDrawingEngine->ConstrainClippingRegion(&visibleBorder);
if (fIsZooming) {
fDecorator->SetZoom(_ActionFor(msg) == DEC_ZOOM);
} else if (fIsClosing) {
@@ -939,13 +971,15 @@ WindowLayer::MouseMoved(BMessage *msg, BPoint where, int32* _viewToken)
} else if (fIsMinimizing) {
fDecorator->SetMinimize(_ActionFor(msg) == DEC_MINIMIZE);
}
fDrawingEngine->Unlock();
}
if (fIsDragging) {
if (fIsDragging && !(Flags() & B_NOT_MOVABLE)) {
BPoint delta = where - fLastMousePosition;
fDesktop->MoveWindowBy(this, delta.x, delta.y);
}
if (fIsResizing) {
if (fIsResizing && !(Flags() & B_NOT_RESIZABLE)) {
BPoint delta = where - fLastMousePosition;
if (Flags() & B_NOT_V_RESIZABLE)
delta.y = 0;
@@ -1013,25 +1047,19 @@ WindowLayer::Activated(bool active)
void
WindowLayer::SetTitle(const char* name)
WindowLayer::SetTitle(const char* name, BRegion& dirty)
{
// rebuild the clipping for the title area
// and redraw it.
fTitle = name;
/* TODO: SetTitle
if (fDecorator) {
// TODO: need locking here too
BRegion updateRegion;
fDecorator->SetTitle(name, &updateRegion);
fDecorator->SetTitle(name, &dirty);
if (fVisible && fDesktop & fDesktop->WriteLockWindows()) {
// ....
fDesktop->WriteUnlockWindows();
}
fBorderRegionValid = false;
// the border very likely changed
}
*/
}
+1 -1
View File
@@ -123,7 +123,7 @@ class WindowLayer {
void Activated(bool active);
// changing some properties
void SetTitle(const char* name);
void SetTitle(const char* name, BRegion& dirty);
void SetFocus(bool focus);
bool IsFocus() const { return fIsFocus; }