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