diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp index b72d94e2c0..20d8e9c72f 100644 --- a/src/servers/app/Desktop.cpp +++ b/src/servers/app/Desktop.cpp @@ -21,7 +21,6 @@ #include "AppServer.h" #include "DrawingEngine.h" -#include "Globals.h" #include "Layer.h" #include "RootLayer.h" #include "ServerConfig.h" diff --git a/src/servers/app/RootLayer.cpp b/src/servers/app/RootLayer.cpp index 5847768878..6a0f59ca6b 100644 --- a/src/servers/app/RootLayer.cpp +++ b/src/servers/app/RootLayer.cpp @@ -24,7 +24,6 @@ #include "Decorator.h" #include "DrawingEngine.h" -#include "Globals.h" #include "HWInterface.h" #include "Layer.h" #include "ServerApp.h" diff --git a/src/servers/app/ServerWindow.cpp b/src/servers/app/ServerWindow.cpp index 9449f858de..b6c44849c1 100644 --- a/src/servers/app/ServerWindow.cpp +++ b/src/servers/app/ServerWindow.cpp @@ -2163,7 +2163,9 @@ ServerWindow::HandleDirectConnection(int bufferState, int driverState) // Releasing this sem causes the client to call BDirectWindow::DirectConnected() release_sem(fDirectWindowData->direct_sem); - // TODO: Waiting 3 seconds in this thread could cause weird things: test + // TODO: Waiting 3 seconds in this thread is not a problem, + // but since we are called from the RootLayer's thread too, very bad things could happen. + // Find some way to call this method only within ServerWindow's thread (messaging ?) status_t status = acquire_sem_etc(fDirectWindowData->direct_sem_ack, 1, B_TIMEOUT, 3000000); if (status == B_TIMED_OUT) { // The client application didn't release the semaphore diff --git a/src/servers/app/WinBorder.cpp b/src/servers/app/WinBorder.cpp index ab02eb59cb..5ee5f0d893 100644 --- a/src/servers/app/WinBorder.cpp +++ b/src/servers/app/WinBorder.cpp @@ -8,6 +8,7 @@ */ +#include #include #include #include @@ -20,16 +21,16 @@ #include "Decorator.h" #include "DecorManager.h" #include "Desktop.h" -#include "Globals.h" #include "MessagePrivate.h" #include "PortLink.h" #include "RootLayer.h" #include "ServerApp.h" #include "ServerWindow.h" #include "TokenHandler.h" +#include "WinBorder.h" #include "Workspace.h" -#include "WinBorder.h" + // Toggle general function call output //#define DEBUG_WINBORDER @@ -172,7 +173,20 @@ WinBorder::Draw(const BRect &r) void WinBorder::MoveBy(float x, float y) { + if (x == 0 && y == 0) + return; + + // 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); } @@ -180,8 +194,12 @@ void WinBorder::ResizeBy(float x, float y) { STRACE(("WinBorder(%s)::ResizeBy()\n", Name())); - + if (x == 0 && y == 0) + return; + + //Window()->HandleDirectConnection(B_DIRECT_STOP); _ResizeBy(x, y); + //Window()->HandleDirectConnection(B_DIRECT_START|B_BUFFER_RESIZED); }