diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp index 496ed399b8..7eb05eb054 100644 --- a/src/servers/app/Desktop.cpp +++ b/src/servers/app/Desktop.cpp @@ -1707,7 +1707,6 @@ Desktop::SetWindowFlags(WindowLayer *window, uint32 newFlags) _TriggerWindowRedrawing(dirty); - UnlockAllWindows(); } @@ -1820,8 +1819,10 @@ Desktop::WindowAction(int32 windowToken, int32 action) ::ServerWindow* serverWindow; if (BPrivate::gDefaultTokens.GetToken(windowToken, - B_SERVER_TOKEN, (void**)&serverWindow) != B_OK) + B_SERVER_TOKEN, (void**)&serverWindow) != B_OK) { + UnlockAllWindows(); return; + } if (action == B_BRING_TO_FRONT && !serverWindow->Window()->IsMinimized()) { diff --git a/src/servers/app/ServerWindow.cpp b/src/servers/app/ServerWindow.cpp index 3043c6898c..268a84b239 100644 --- a/src/servers/app/ServerWindow.cpp +++ b/src/servers/app/ServerWindow.cpp @@ -851,12 +851,16 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) link.Read(&minHeight); link.Read(&maxHeight); */ + fDesktop->UnlockSingleWindow(); + if (fDesktop->LockAllWindows()) { fWindowLayer->SetSizeLimits(minWidth, maxWidth, minHeight, maxHeight); fDesktop->UnlockAllWindows(); } + fDesktop->LockSingleWindow(); + // and now, sync the client to the limits that we were able to enforce fWindowLayer->GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight); @@ -899,9 +903,9 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) case AS_GET_MOUSE: { -fDesktop->UnlockSingleWindow(); DTRACE(("ServerWindow %s: Message AS_GET_MOUSE\n", fTitle)); + fDesktop->UnlockSingleWindow(); // Returns // 1) BPoint mouse location // 2) int32 button state @@ -914,7 +918,7 @@ fDesktop->UnlockSingleWindow(); fLink.Attach(where); fLink.Attach(buttons); fLink.Flush(); -fDesktop->LockSingleWindow(); + fDesktop->LockSingleWindow(); break; } @@ -1150,21 +1154,18 @@ ServerWindow::_DispatchViewMessage(int32 code, float offsetX = x - fCurrentLayer->Frame().left; float offsetY = y - fCurrentLayer->Frame().top; - if (fDesktop->LockSingleWindow()) { - BRegion dirty; - fCurrentLayer->MoveBy(offsetX, offsetY, &dirty); + BRegion dirty; + fCurrentLayer->MoveBy(offsetX, offsetY, &dirty); - // TODO: think about how to avoid this hack: - // the parent clipping needs to be updated, it is not - // done in ResizeBy() since it would need to avoid - // too much computations when children are resized because - // follow modes - if (ViewLayer* parent = fCurrentLayer->Parent()) - parent->RebuildClipping(false); + // TODO: think about how to avoid this hack: + // the parent clipping needs to be updated, it is not + // done in ResizeBy() since it would need to avoid + // too much computations when children are resized because + // follow modes + if (ViewLayer* parent = fCurrentLayer->Parent()) + parent->RebuildClipping(false); - fWindowLayer->MarkContentDirty(dirty); - fDesktop->UnlockSingleWindow(); - } + fWindowLayer->MarkContentDirty(dirty); break; } case AS_LAYER_RESIZE_TO: @@ -1179,23 +1180,18 @@ ServerWindow::_DispatchViewMessage(int32 code, float deltaWidth = newWidth - fCurrentLayer->Frame().Width(); float deltaHeight = newHeight - fCurrentLayer->Frame().Height(); - if (fDesktop->LockSingleWindow()) { - BRegion dirty; - fCurrentLayer->ResizeBy(deltaWidth, deltaHeight, &dirty); + BRegion dirty; + fCurrentLayer->ResizeBy(deltaWidth, deltaHeight, &dirty); - // TODO: see above - if (ViewLayer* parent = fCurrentLayer->Parent()) - parent->RebuildClipping(false); + // TODO: see above + if (ViewLayer* parent = fCurrentLayer->Parent()) + parent->RebuildClipping(false); - fWindowLayer->MarkContentDirty(dirty); - fDesktop->UnlockSingleWindow(); - } + fWindowLayer->MarkContentDirty(dirty); break; } case AS_LAYER_GET_COORD: { - fDesktop->LockSingleWindow(); - STRACE(("ServerWindow %s: Message AS_LAYER_GET_COORD: ViewLayer: %s\n", Title(), fCurrentLayer->Name())); fLink.StartMessage(B_OK); // our offset in the parent -> will be originX and originY in BView @@ -1203,8 +1199,6 @@ ServerWindow::_DispatchViewMessage(int32 code, fLink.Attach(fCurrentLayer->Frame().top); fLink.Attach(fCurrentLayer->Bounds()); fLink.Flush(); - - fDesktop->UnlockSingleWindow(); break; } case AS_LAYER_SET_ORIGIN: @@ -1844,10 +1838,7 @@ ServerWindow::_DispatchViewMessage(int32 code, } default: - if (fDesktop->LockSingleWindow()) { - _DispatchViewDrawingMessage(code, link); - fDesktop->UnlockSingleWindow(); - } + _DispatchViewDrawingMessage(code, link); break; } }