From ab88eaf2ad28d134e65900e7f4ec60525b9f4f3b Mon Sep 17 00:00:00 2001 From: Adi Oanca Date: Sun, 27 Mar 2005 12:19:37 +0000 Subject: [PATCH] BWindows are notified when they are moved or resized. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12074 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/RootLayer.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/servers/app/RootLayer.cpp b/src/servers/app/RootLayer.cpp index 35a8e7f929..ba53a7cab7 100644 --- a/src/servers/app/RootLayer.cpp +++ b/src/servers/app/RootLayer.cpp @@ -1074,7 +1074,8 @@ void RootLayer::MouseEventHandler(int32 code, BPortLink& msg) GetDisplayDriver()->MoveCursorTo(evt.where.x, evt.where.y); -// TODO: lock here! +// TODO: lock ServerWindow here! Don't forget, you need to add/remove Layers +// from within RootLayer's thread!!! Layer *target = LayerAt(evt.where); if (target == NULL) debugger("RootLayer::MouseEventHandler: 'target' can't be null.\n"); @@ -1175,6 +1176,13 @@ void RootLayer::MouseEventHandler(int32 code, BPortLink& msg) winBorderUnder->fDecorator->MoveBy(pt.x, pt.y); winBorderUnder->move_layer(pt.x, pt.y); + + // I know the way we get BWindow's new location it's not nice :-), + // but I don't see another way. fTopLayer.Frame().LeftTop() does not change, ever. + BPoint location(winBorderUnder->fTopLayer->fFull.Frame().LeftTop()); + BMessage msg(B_WINDOW_MOVED); + msg.AddPoint("where", location); + winBorderUnder->Window()->SendMessageToClient(&msg, B_NULL_TOKEN, false); } else if (fResizingWindow) { @@ -1182,6 +1190,12 @@ void RootLayer::MouseEventHandler(int32 code, BPortLink& msg) winBorderUnder->fDecorator->ResizeBy(pt.x, pt.y); winBorderUnder->resize_layer(pt.x, pt.y); + + BRect frame(winBorderUnder->fTopLayer->Frame()); + BMessage msg(B_WINDOW_RESIZED); + msg.AddInt32("width", frame.Width()); + msg.AddInt32("height", frame.Height()); + winBorderUnder->Window()->SendMessageToClient(&msg, B_NULL_TOKEN, false); } else {