* Fixed a possible locking bug in Desktop::WindowAction().
* Cleaned up locking a bit. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16686 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1707,7 +1707,6 @@ Desktop::SetWindowFlags(WindowLayer *window, uint32 newFlags)
|
|||||||
|
|
||||||
_TriggerWindowRedrawing(dirty);
|
_TriggerWindowRedrawing(dirty);
|
||||||
|
|
||||||
|
|
||||||
UnlockAllWindows();
|
UnlockAllWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1820,8 +1819,10 @@ Desktop::WindowAction(int32 windowToken, int32 action)
|
|||||||
|
|
||||||
::ServerWindow* serverWindow;
|
::ServerWindow* serverWindow;
|
||||||
if (BPrivate::gDefaultTokens.GetToken(windowToken,
|
if (BPrivate::gDefaultTokens.GetToken(windowToken,
|
||||||
B_SERVER_TOKEN, (void**)&serverWindow) != B_OK)
|
B_SERVER_TOKEN, (void**)&serverWindow) != B_OK) {
|
||||||
|
UnlockAllWindows();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (action == B_BRING_TO_FRONT
|
if (action == B_BRING_TO_FRONT
|
||||||
&& !serverWindow->Window()->IsMinimized()) {
|
&& !serverWindow->Window()->IsMinimized()) {
|
||||||
|
|||||||
@@ -851,12 +851,16 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
link.Read<int32>(&minHeight);
|
link.Read<int32>(&minHeight);
|
||||||
link.Read<int32>(&maxHeight);
|
link.Read<int32>(&maxHeight);
|
||||||
*/
|
*/
|
||||||
|
fDesktop->UnlockSingleWindow();
|
||||||
|
|
||||||
if (fDesktop->LockAllWindows()) {
|
if (fDesktop->LockAllWindows()) {
|
||||||
fWindowLayer->SetSizeLimits(minWidth, maxWidth,
|
fWindowLayer->SetSizeLimits(minWidth, maxWidth,
|
||||||
minHeight, maxHeight);
|
minHeight, maxHeight);
|
||||||
fDesktop->UnlockAllWindows();
|
fDesktop->UnlockAllWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fDesktop->LockSingleWindow();
|
||||||
|
|
||||||
// and now, sync the client to the limits that we were able to enforce
|
// and now, sync the client to the limits that we were able to enforce
|
||||||
fWindowLayer->GetSizeLimits(&minWidth, &maxWidth,
|
fWindowLayer->GetSizeLimits(&minWidth, &maxWidth,
|
||||||
&minHeight, &maxHeight);
|
&minHeight, &maxHeight);
|
||||||
@@ -899,9 +903,9 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
|
|
||||||
case AS_GET_MOUSE:
|
case AS_GET_MOUSE:
|
||||||
{
|
{
|
||||||
fDesktop->UnlockSingleWindow();
|
|
||||||
DTRACE(("ServerWindow %s: Message AS_GET_MOUSE\n", fTitle));
|
DTRACE(("ServerWindow %s: Message AS_GET_MOUSE\n", fTitle));
|
||||||
|
|
||||||
|
fDesktop->UnlockSingleWindow();
|
||||||
// Returns
|
// Returns
|
||||||
// 1) BPoint mouse location
|
// 1) BPoint mouse location
|
||||||
// 2) int32 button state
|
// 2) int32 button state
|
||||||
@@ -914,7 +918,7 @@ fDesktop->UnlockSingleWindow();
|
|||||||
fLink.Attach<BPoint>(where);
|
fLink.Attach<BPoint>(where);
|
||||||
fLink.Attach<int32>(buttons);
|
fLink.Attach<int32>(buttons);
|
||||||
fLink.Flush();
|
fLink.Flush();
|
||||||
fDesktop->LockSingleWindow();
|
fDesktop->LockSingleWindow();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1150,7 +1154,6 @@ ServerWindow::_DispatchViewMessage(int32 code,
|
|||||||
float offsetX = x - fCurrentLayer->Frame().left;
|
float offsetX = x - fCurrentLayer->Frame().left;
|
||||||
float offsetY = y - fCurrentLayer->Frame().top;
|
float offsetY = y - fCurrentLayer->Frame().top;
|
||||||
|
|
||||||
if (fDesktop->LockSingleWindow()) {
|
|
||||||
BRegion dirty;
|
BRegion dirty;
|
||||||
fCurrentLayer->MoveBy(offsetX, offsetY, &dirty);
|
fCurrentLayer->MoveBy(offsetX, offsetY, &dirty);
|
||||||
|
|
||||||
@@ -1163,8 +1166,6 @@ ServerWindow::_DispatchViewMessage(int32 code,
|
|||||||
parent->RebuildClipping(false);
|
parent->RebuildClipping(false);
|
||||||
|
|
||||||
fWindowLayer->MarkContentDirty(dirty);
|
fWindowLayer->MarkContentDirty(dirty);
|
||||||
fDesktop->UnlockSingleWindow();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_LAYER_RESIZE_TO:
|
case AS_LAYER_RESIZE_TO:
|
||||||
@@ -1179,7 +1180,6 @@ ServerWindow::_DispatchViewMessage(int32 code,
|
|||||||
float deltaWidth = newWidth - fCurrentLayer->Frame().Width();
|
float deltaWidth = newWidth - fCurrentLayer->Frame().Width();
|
||||||
float deltaHeight = newHeight - fCurrentLayer->Frame().Height();
|
float deltaHeight = newHeight - fCurrentLayer->Frame().Height();
|
||||||
|
|
||||||
if (fDesktop->LockSingleWindow()) {
|
|
||||||
BRegion dirty;
|
BRegion dirty;
|
||||||
fCurrentLayer->ResizeBy(deltaWidth, deltaHeight, &dirty);
|
fCurrentLayer->ResizeBy(deltaWidth, deltaHeight, &dirty);
|
||||||
|
|
||||||
@@ -1188,14 +1188,10 @@ ServerWindow::_DispatchViewMessage(int32 code,
|
|||||||
parent->RebuildClipping(false);
|
parent->RebuildClipping(false);
|
||||||
|
|
||||||
fWindowLayer->MarkContentDirty(dirty);
|
fWindowLayer->MarkContentDirty(dirty);
|
||||||
fDesktop->UnlockSingleWindow();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_LAYER_GET_COORD:
|
case AS_LAYER_GET_COORD:
|
||||||
{
|
{
|
||||||
fDesktop->LockSingleWindow();
|
|
||||||
|
|
||||||
STRACE(("ServerWindow %s: Message AS_LAYER_GET_COORD: ViewLayer: %s\n", Title(), fCurrentLayer->Name()));
|
STRACE(("ServerWindow %s: Message AS_LAYER_GET_COORD: ViewLayer: %s\n", Title(), fCurrentLayer->Name()));
|
||||||
fLink.StartMessage(B_OK);
|
fLink.StartMessage(B_OK);
|
||||||
// our offset in the parent -> will be originX and originY in BView
|
// our offset in the parent -> will be originX and originY in BView
|
||||||
@@ -1203,8 +1199,6 @@ ServerWindow::_DispatchViewMessage(int32 code,
|
|||||||
fLink.Attach<float>(fCurrentLayer->Frame().top);
|
fLink.Attach<float>(fCurrentLayer->Frame().top);
|
||||||
fLink.Attach<BRect>(fCurrentLayer->Bounds());
|
fLink.Attach<BRect>(fCurrentLayer->Bounds());
|
||||||
fLink.Flush();
|
fLink.Flush();
|
||||||
|
|
||||||
fDesktop->UnlockSingleWindow();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_LAYER_SET_ORIGIN:
|
case AS_LAYER_SET_ORIGIN:
|
||||||
@@ -1844,10 +1838,7 @@ ServerWindow::_DispatchViewMessage(int32 code,
|
|||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (fDesktop->LockSingleWindow()) {
|
|
||||||
_DispatchViewDrawingMessage(code, link);
|
_DispatchViewDrawingMessage(code, link);
|
||||||
fDesktop->UnlockSingleWindow();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user