From 485b94873199f8f49b814f89f8d13144c1281521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 26 Nov 2005 20:22:30 +0000 Subject: [PATCH] Removed "Active" stuff from Workspaces state. As a side effect, the desktop is now clickable again. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15173 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/RootLayer.cpp | 13 ++++++------- src/servers/app/RootLayer.h | 2 +- src/servers/app/WindowLayer.cpp | 2 +- src/servers/app/Workspace.cpp | 21 +++++++-------------- src/servers/app/Workspace.h | 1 - 5 files changed, 15 insertions(+), 24 deletions(-) diff --git a/src/servers/app/RootLayer.cpp b/src/servers/app/RootLayer.cpp index f3495fa6ee..a46c8c9413 100644 --- a/src/servers/app/RootLayer.cpp +++ b/src/servers/app/RootLayer.cpp @@ -704,18 +704,17 @@ RootLayer::RevealNewWMState(Workspace::State &oldWMState) // clear fWMState fWMState.Focus = NULL; fWMState.Front = NULL; - fWMState.Active = NULL; fWMState.WindowList.MakeEmpty(); ActiveWorkspace()->GetState(&fWMState); // send window activation messages - if (oldWMState.Active != fWMState.Active) { - if (oldWMState.Active) - oldWMState.Active->Activated(false); - if (fWMState.Active) { - fWMState.Active->Activated(true); - fDesktop->EventDispatcher().SetFocus(&fWMState.Active->Window()->FocusMessenger()); + if (oldWMState.Focus != fWMState.Focus) { + if (oldWMState.Focus) + oldWMState.Focus->Activated(false); + if (fWMState.Focus) { + fWMState.Focus->Activated(true); + fDesktop->EventDispatcher().SetFocus(&fWMState.Focus->Window()->FocusMessenger()); } else fDesktop->EventDispatcher().SetFocus(NULL); } diff --git a/src/servers/app/RootLayer.h b/src/servers/app/RootLayer.h index 65648931a9..4c613c3b53 100644 --- a/src/servers/app/RootLayer.h +++ b/src/servers/app/RootLayer.h @@ -70,7 +70,7 @@ public: // TODO: we need to replace Winborder* with Layer* inline WindowLayer* Focus() const { return fWMState.Focus; } inline WindowLayer* Front() const { return fWMState.Front; } - inline WindowLayer* Active() const { return fWMState.Active; } + inline WindowLayer* Active() const { return fWMState.Focus; } bool SetActive(WindowLayer* newActive, bool activate = true); inline void SetWorkspaceCount(int32 wksCount); diff --git a/src/servers/app/WindowLayer.cpp b/src/servers/app/WindowLayer.cpp index 3f1832e8aa..727be207c7 100644 --- a/src/servers/app/WindowLayer.cpp +++ b/src/servers/app/WindowLayer.cpp @@ -456,7 +456,7 @@ WindowLayer::MouseDown(BMessage *msg, BPoint where) } } else if (target != NULL) { // clicking a simple Layer. - if (GetRootLayer()->ActiveWorkspace()->Active() != this) { + if (GetRootLayer()->ActiveWorkspace()->Focus() != this) { DesktopSettings desktopSettings(GetRootLayer()->GetDesktop()); // not in FFM mode? diff --git a/src/servers/app/Workspace.cpp b/src/servers/app/Workspace.cpp index 19165e4c05..29ef795af8 100644 --- a/src/servers/app/Workspace.cpp +++ b/src/servers/app/Workspace.cpp @@ -96,7 +96,6 @@ Workspace::State::PrintToStream() { printf("WS::State - Front: %s\n", Front? Front->Name(): "NULL"); printf("WS::State - Focus: %s\n", Focus? Focus->Name(): "NULL"); - printf("WS::State - Active: %s\n", Active? Active->Name(): "NULL"); for (int32 i = 0; i < WindowList.CountItems(); ++i) { Layer *l = (Layer*)WindowList.ItemAt(i); @@ -215,33 +214,24 @@ Workspace::Front() const WindowLayer * Workspace::Active() const { - // in case of a normal or modal window - if (fFrontItem && fFrontItem == fFocusItem) - return fFrontItem->layerPtr; - - // a floating window is considered active if it has focus. - if (fFocusItem && (fFocusItem->layerPtr->Level() == B_FLOATING_APP || - fFocusItem->layerPtr->Level() == B_FLOATING_ALL)) - return fFocusItem->layerPtr; - - return NULL; + return fFocusItem ? fFocusItem->layerPtr : NULL; } + /*! \brief Method that returns the state of window manager. \param state - a pointer to a valid Workspace::State structure \return void Fills the state structure with the most important window manager attibutes: -front window, focus window, active window and the list of windows starting from -the backmost one at position 0 and ending with the most visible window. + front window, focus window, active window and the list of windows starting from + the backmost one at position 0 and ending with the most visible window. */ void Workspace::GetState(Workspace::State *state) const { state->Front = Front(); state->Focus = Focus(); - state->Active = Active(); ListData *cursor = fTopItem; while (cursor) { @@ -250,12 +240,15 @@ Workspace::GetState(Workspace::State *state) const cursor = cursor->lowerItem; } } + + bool Workspace::AttemptToSetFront(WindowLayer *newFront) { return MoveToFront(newFront); } + int32 Workspace::AttemptToSetFocus(WindowLayer *newFocus) { diff --git a/src/servers/app/Workspace.h b/src/servers/app/Workspace.h index 72a116f523..ad8e9e16f1 100644 --- a/src/servers/app/Workspace.h +++ b/src/servers/app/Workspace.h @@ -57,7 +57,6 @@ class Workspace { WindowLayer* Front; WindowLayer* Focus; - WindowLayer* Active; BList WindowList; }; Workspace( const int32 ID,