From 2eef77bfda11395b75dddf668f033a7c2425e942 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Wed, 23 Dec 2009 21:25:42 +0000 Subject: [PATCH] MacDecorator : fix a liitle drawing bug (missing border under window tab) and make resizing work. I see no other bug now, but testing welcome. You can change the decorator using the setdecor command, but you have to add MacDecorator in /home/config/add-ons/decorators first. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34761 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../decorators/MacDecorator/MacDecorator.cpp | 43 +++++-------------- 1 file changed, 10 insertions(+), 33 deletions(-) diff --git a/src/add-ons/decorators/MacDecorator/MacDecorator.cpp b/src/add-ons/decorators/MacDecorator/MacDecorator.cpp index 8f1506b19b..d7b2610843 100644 --- a/src/add-ons/decorators/MacDecorator/MacDecorator.cpp +++ b/src/add-ons/decorators/MacDecorator/MacDecorator.cpp @@ -172,36 +172,16 @@ MacDecorator::ResizeBy(BPoint offset, BRegion* dirty) fTabRect.right += offset.x; fBorderRect.right += offset.x; fBorderRect.bottom += offset.y; - fZoomRect.OffsetBy(offset.x,0); - fMinimizeRect.OffsetBy(offset.x,0); - - // handle invalidation of resize rect - if (dirty && !(fFlags & B_NOT_RESIZABLE)) { - BRect realResizeRect; - switch (fLook) { - case B_DOCUMENT_WINDOW_LOOK: - realResizeRect = fResizeRect; - // resize rect at old location - dirty->Include(realResizeRect); - realResizeRect.OffsetBy(offset); - // resize rect at new location - dirty->Include(realResizeRect); - break; - case B_TITLED_WINDOW_LOOK: - case B_FLOATING_WINDOW_LOOK: - case B_MODAL_WINDOW_LOOK: - // resize rect at old location - dirty->Include(fBorderRect); - fBorderRect.OffsetBy(offset); - // resize rect at new location - dirty->Include(fBorderRect); - break; - default: - break; - } + // fZoomRect.OffsetBy(offset.x,0); + // fMinimizeRect.OffsetBy(offset.x,0); + if (dirty) { + dirty->Include(fTabRect); + dirty->Include(fBorderRect); } + // TODO probably some other layouting stuff here + _DoLayout(); } // settablocation @@ -282,14 +262,11 @@ MacDecorator::Clicked(BPoint point, int32 buttons, int32 modifiers) } // We got this far, so user is clicking on the border? - BRect srect(fFrame); - srect.top+=19; - BRect clientrect(srect.InsetByCopy(3,3)); if (!(fFlags & B_NOT_RESIZABLE) && (fLook == B_TITLED_WINDOW_LOOK || fLook == B_FLOATING_WINDOW_LOOK || fLook == B_MODAL_WINDOW_LOOK) - && srect.Contains(point) && !clientrect.Contains(point)) { + && fBorderRect.Contains(point) && !fFrame.Contains(point)) { STRACE(("MacDecorator():Clicked() - Resize\n")); return DEC_RESIZE; } @@ -341,10 +318,10 @@ MacDecorator::_DoLayout(void) // TODO the tab is drawn in a fixed height for now fTabRect.Set(fFrame.left - fBorderWidth, - fFrame.top - 20, + fFrame.top - 23, ((fFrame.right - fFrame.left) < 32.0 ? fFrame.left + 32.0 : fFrame.right) + fBorderWidth, - fFrame.top); + fFrame.top - 3); fZoomRect=fTabRect; fZoomRect.left=fZoomRect.right-12;