From b2cc1487d118974f7179dbdac6cccd2a39858f5d Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Fri, 11 Nov 2005 00:10:03 +0000 Subject: [PATCH] Send notifications for directwindow when a window is moved git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14843 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/WinBorder.cpp | 43 +++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/src/servers/app/WinBorder.cpp b/src/servers/app/WinBorder.cpp index 673f378960..7d2e6c3b84 100644 --- a/src/servers/app/WinBorder.cpp +++ b/src/servers/app/WinBorder.cpp @@ -178,18 +178,33 @@ WinBorder::MoveBy(float x, float y) return; // lock here because we play with some regions - if (GetRootLayer() && GetRootLayer()->Lock()) { - fDecRegion.OffsetBy(x, y); + if (GetRootLayer()) { + // TODO: MoveBy and ResizeBy() are usually called + // from the rootlayer's thread. HandleDirectConnection() could + // block the calling thread for ~3 seconds in the worst case, + // and while it would be acceptable if called from the + // ServerWindow's thread (only the window would be blocked), in this case + // it's not, as also the mouse movement is driven by rootlayer. + // Find some way to call DirectConnected() from the ServerWindow's thread, + // by sending a message from here or whatever. + Window()->HandleDirectConnection(B_DIRECT_STOP); + + if (GetRootLayer()->Lock()) { + fDecRegion.OffsetBy(x, y); - fCumulativeRegion.OffsetBy(x, y); - fInUpdateRegion.OffsetBy(x, y); + fCumulativeRegion.OffsetBy(x, y); + fInUpdateRegion.OffsetBy(x, y); - if (fDecorator) - fDecorator->MoveBy(x, y); + if (fDecorator) + fDecorator->MoveBy(x, y); - Layer::MoveBy(x, y); + Layer::MoveBy(x, y); - GetRootLayer()->Unlock(); + GetRootLayer()->Unlock(); + } + + Window()->HandleDirectConnection(B_DIRECT_START|B_BUFFER_MOVED); + } else { // just offset to the new position if (fDecorator) @@ -203,18 +218,6 @@ WinBorder::MoveBy(float x, float y) msg.AddInt64("when", system_time()); msg.AddPoint("where", Frame().LeftTop()); Window()->SendMessageToClient(&msg, B_NULL_TOKEN, false); - - // TODO: MoveBy and ResizeBy() are usually called - // from the rootlayer's thread. HandleDirectConnection() could - // block the calling thread for ~3 seconds in the worst case, - // and while it would be acceptable if called from the - // ServerWindow's thread (only the window would be blocked), in this case - // it's not, as also the mouse movement is driven by rootlayer. - // Find some way to call DirectConnected() from the ServerWindow's thread, - // by sending a message from here or whatever. - //Window()->HandleDirectConnection(B_DIRECT_STOP); -// Layer::MoveBy(x, y); - //Window()->HandleDirectConnection(B_DIRECT_START|B_BUFFER_MOVED); }