implemented TODOs from Desktop::ActivateWindow():
* If the window is on another workspace, the workspace will be activated or the window will come to the current workspace or nothing will happen depending on the windows flags. Tested with WonderBrush, but I just now realise that it will also fix activating a window in the Deskbar, which is on a different workspace. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17284 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
5e9bdfc4d7
commit
e647873a03
@ -1212,24 +1212,47 @@ Desktop::ActivateWindow(WindowLayer* window)
|
|||||||
{
|
{
|
||||||
STRACE(("ActivateWindow(%p, %s)\n", window, window ? window->Title() : "<none>"));
|
STRACE(("ActivateWindow(%p, %s)\n", window, window ? window->Title() : "<none>"));
|
||||||
|
|
||||||
// TODO: handle this case correctly! (ie. honour B_NOT_ANCHORED_ON_ACTIVATE,
|
|
||||||
// B_NO_WORKSPACE_ACTIVATION, switch workspaces, ...)
|
|
||||||
if (!window->InWorkspace(fCurrentWorkspace))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (window == NULL) {
|
if (window == NULL) {
|
||||||
fBack = NULL;
|
fBack = NULL;
|
||||||
fFront = NULL;
|
fFront = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: support B_NO_WORKSPACE_ACTIVATION
|
bool windowOnOtherWorkspace = !window->InWorkspace(fCurrentWorkspace);
|
||||||
// TODO: support B_NOT_ANCHORED_ON_ACTIVATE
|
|
||||||
|
if (windowOnOtherWorkspace
|
||||||
|
&& (window->Flags() & B_NO_WORKSPACE_ACTIVATION)
|
||||||
|
&& !(window->Flags() & B_NOT_ANCHORED_ON_ACTIVATE))
|
||||||
|
return;
|
||||||
|
|
||||||
// TODO: take care about floating windows
|
// TODO: take care about floating windows
|
||||||
|
|
||||||
if (!LockAllWindows())
|
if (!LockAllWindows())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (windowOnOtherWorkspace) {
|
||||||
|
// if the window wants to come to the current workspace,
|
||||||
|
// do so here - else activate the workspace on which this
|
||||||
|
// window is
|
||||||
|
if (window->Flags() & B_NOT_ANCHORED_ON_ACTIVATE) {
|
||||||
|
// bring the window to the current workspace
|
||||||
|
// TODO: what if this window is on multiple workspaces?!?
|
||||||
|
uint32 workspaces = workspace_to_workspaces(fCurrentWorkspace);
|
||||||
|
SetWindowWorkspaces(window, workspaces);
|
||||||
|
} else {
|
||||||
|
// switch to the workspace on which this window is
|
||||||
|
// (we'll take the first one that the window is on)
|
||||||
|
uint32 workspaces = window->Workspaces();
|
||||||
|
for (int32 i = 0; i < 32; i++) {
|
||||||
|
uint32 workspace = workspace_to_workspaces(i);
|
||||||
|
if (workspaces & workspace) {
|
||||||
|
SetWorkspace(i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (window == FrontWindow()) {
|
if (window == FrontWindow()) {
|
||||||
// see if there is a normal B_AVOID_FRONT window still in front of us
|
// see if there is a normal B_AVOID_FRONT window still in front of us
|
||||||
WindowLayer* avoidsFront = window->NextWindow(fCurrentWorkspace);
|
WindowLayer* avoidsFront = window->NextWindow(fCurrentWorkspace);
|
||||||
|
Loading…
Reference in New Issue
Block a user