Windows currently being dragged now follow workspace switches.
Desktop::_ChangeWindowWorkspaces() and SetWorkspace() didn't lock the window list, but should have. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15421 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -579,8 +579,29 @@ Desktop::SetWorkspace(int32 index)
|
|||||||
if (index < 0 || index >= settings.WorkspacesCount() || index == fCurrentWorkspace)
|
if (index < 0 || index >= settings.WorkspacesCount() || index == fCurrentWorkspace)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
WriteLockWindows();
|
||||||
|
|
||||||
int32 previousIndex = fCurrentWorkspace;
|
int32 previousIndex = fCurrentWorkspace;
|
||||||
|
|
||||||
|
if (fMouseEventWindow != NULL) {
|
||||||
|
// the window currently being dragged will follow us to this workspace
|
||||||
|
// if it's not already on it
|
||||||
|
if (!fMouseEventWindow->OnWorkspace(index)) {
|
||||||
|
fWorkspaces[index].Windows().AddWindow(fMouseEventWindow);
|
||||||
|
fMouseEventWindow->SetWorkspaces((fMouseEventWindow->Workspaces()
|
||||||
|
| workspace_to_workspaces(index))
|
||||||
|
& ~workspace_to_workspaces(previousIndex));
|
||||||
|
fWorkspaces[previousIndex].Windows().RemoveWindow(fMouseEventWindow);
|
||||||
|
} else {
|
||||||
|
// make sure it's frontmost
|
||||||
|
fWorkspaces[index].Windows().RemoveWindow(fMouseEventWindow);
|
||||||
|
fWorkspaces[index].Windows().AddWindow(fMouseEventWindow,
|
||||||
|
fMouseEventWindow->Frontmost(fWorkspaces[index].Windows().FirstWindow(), index));
|
||||||
|
}
|
||||||
|
|
||||||
|
fMouseEventWindow->Anchor(index).position = fMouseEventWindow->Frame().LeftTop();
|
||||||
|
}
|
||||||
|
|
||||||
// build region of windows that are no longer visible in the new workspace
|
// build region of windows that are no longer visible in the new workspace
|
||||||
|
|
||||||
BRegion dirty;
|
BRegion dirty;
|
||||||
@@ -640,7 +661,7 @@ Desktop::SetWorkspace(int32 index)
|
|||||||
|
|
||||||
for (WindowLayer* window = _CurrentWindows().FirstWindow(); window != NULL;
|
for (WindowLayer* window = _CurrentWindows().FirstWindow(); window != NULL;
|
||||||
window = window->NextWindow(index)) {
|
window = window->NextWindow(index)) {
|
||||||
if (window->OnWorkspace(previousIndex)) {
|
if (window->OnWorkspace(previousIndex) || window == fMouseEventWindow) {
|
||||||
// this window was visible before, and is already handled in the above loop
|
// this window was visible before, and is already handled in the above loop
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -652,7 +673,9 @@ Desktop::SetWorkspace(int32 index)
|
|||||||
SetFocusWindow(FrontWindow());
|
SetFocusWindow(FrontWindow());
|
||||||
|
|
||||||
MarkDirty(dirty);
|
MarkDirty(dirty);
|
||||||
|
|
||||||
//_WindowsChanged();
|
//_WindowsChanged();
|
||||||
|
WriteUnlockWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1117,8 +1140,9 @@ void
|
|||||||
Desktop::_ChangeWindowWorkspaces(WindowLayer* window, uint32 oldWorkspaces,
|
Desktop::_ChangeWindowWorkspaces(WindowLayer* window, uint32 oldWorkspaces,
|
||||||
uint32 newWorkspaces)
|
uint32 newWorkspaces)
|
||||||
{
|
{
|
||||||
// apply changes to the workspaces' window list
|
// apply changes to the workspaces' window lists
|
||||||
// (and RootLayer, for the current workspace)
|
|
||||||
|
WriteLockWindows();
|
||||||
|
|
||||||
for (int32 i = 0; i < kMaxWorkspaces; i++) {
|
for (int32 i = 0; i < kMaxWorkspaces; i++) {
|
||||||
if (workspaces_on_workspace(i, oldWorkspaces)) {
|
if (workspaces_on_workspace(i, oldWorkspaces)) {
|
||||||
@@ -1145,6 +1169,8 @@ Desktop::_ChangeWindowWorkspaces(WindowLayer* window, uint32 oldWorkspaces,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WriteUnlockWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1152,12 +1178,14 @@ void
|
|||||||
Desktop::SetWindowWorkspaces(WindowLayer* window, uint32 workspaces)
|
Desktop::SetWindowWorkspaces(WindowLayer* window, uint32 workspaces)
|
||||||
{
|
{
|
||||||
BAutolock _(this);
|
BAutolock _(this);
|
||||||
|
|
||||||
if (workspaces == B_CURRENT_WORKSPACE)
|
if (workspaces == B_CURRENT_WORKSPACE)
|
||||||
workspaces = workspace_to_workspaces(CurrentWorkspace());
|
workspaces = workspace_to_workspaces(CurrentWorkspace());
|
||||||
|
|
||||||
|
WriteLockWindows();
|
||||||
_ChangeWindowWorkspaces(window, window->Workspaces(), workspaces);
|
_ChangeWindowWorkspaces(window, window->Workspaces(), workspaces);
|
||||||
window->SetWorkspaces(workspaces);
|
window->SetWorkspaces(workspaces);
|
||||||
|
WriteUnlockWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user