Fixed a stupid bug when checking if the window order changed. Added support for BWindow::Activate(false). Added some debug support for Workspace::WMState. Simplified a bit code for sending a window to back.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14563 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -864,7 +864,7 @@ RootLayer::RevealNewWMState(Workspace::State &oldWMState)
|
|||||||
invalidate = true;
|
invalidate = true;
|
||||||
}
|
}
|
||||||
else if (memcmp(oldWMState.WindowList.Items(), fWMState.WindowList.Items(),
|
else if (memcmp(oldWMState.WindowList.Items(), fWMState.WindowList.Items(),
|
||||||
fWMState.WindowList.CountItems()) != 0) {
|
fWMState.WindowList.CountItems()*sizeof(void*)) != 0) {
|
||||||
invalidate = true;
|
invalidate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -908,7 +908,7 @@ RootLayer::RevealNewWMState(Workspace::State &oldWMState)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
RootLayer::SetActive(WinBorder* newActive)
|
RootLayer::SetActive(WinBorder* newActive, bool activate)
|
||||||
{
|
{
|
||||||
bool returnValue = false;
|
bool returnValue = false;
|
||||||
uint32 workspaceIndex = newActive->Workspaces();
|
uint32 workspaceIndex = newActive->Workspaces();
|
||||||
@@ -921,7 +921,10 @@ RootLayer::SetActive(WinBorder* newActive)
|
|||||||
Workspace::State oldWMState;
|
Workspace::State oldWMState;
|
||||||
ActiveWorkspace()->GetState(&oldWMState);
|
ActiveWorkspace()->GetState(&oldWMState);
|
||||||
|
|
||||||
returnValue = ActiveWorkspace()->AttemptToActivate(newActive);
|
if (activate)
|
||||||
|
returnValue = ActiveWorkspace()->AttemptToActivate(newActive);
|
||||||
|
else
|
||||||
|
returnValue = ActiveWorkspace()->AttemptToMoveToBack(newActive);
|
||||||
|
|
||||||
RevealNewWMState(oldWMState);
|
RevealNewWMState(oldWMState);
|
||||||
}
|
}
|
||||||
@@ -935,7 +938,7 @@ RootLayer::SetActive(WinBorder* newActive)
|
|||||||
|
|
||||||
// If this WinBorder does not appear in current workspace,
|
// If this WinBorder does not appear in current workspace,
|
||||||
// change to the first one who does.
|
// change to the first one who does.
|
||||||
if (!(workspaceIndex & (0x00000001UL << fActiveWksIndex))) {
|
if (activate && !(workspaceIndex & (0x00000001UL << fActiveWksIndex))) {
|
||||||
// find an workspace index in which this Layer appears
|
// find an workspace index in which this Layer appears
|
||||||
for (int32 i = 0; i < kMaxWorkspaceCount; i++) {
|
for (int32 i = 0; i < kMaxWorkspaceCount; i++) {
|
||||||
if (workspaceIndex & (0x00000001UL << i)) {
|
if (workspaceIndex & (0x00000001UL << i)) {
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ public:
|
|||||||
inline WinBorder* Focus() const { return fWMState.Focus; }
|
inline WinBorder* Focus() const { return fWMState.Focus; }
|
||||||
inline WinBorder* Front() const { return fWMState.Front; }
|
inline WinBorder* Front() const { return fWMState.Front; }
|
||||||
inline WinBorder* Active() const { return fWMState.Active; }
|
inline WinBorder* Active() const { return fWMState.Active; }
|
||||||
bool SetActive(WinBorder* newActive);
|
bool SetActive(WinBorder* newActive, bool activate = true);
|
||||||
|
|
||||||
inline void SetWorkspaceCount(int32 wksCount);
|
inline void SetWorkspaceCount(int32 wksCount);
|
||||||
inline int32 WorkspaceCount() const { return fWsCount; }
|
inline int32 WorkspaceCount() const { return fWsCount; }
|
||||||
|
|||||||
@@ -1470,8 +1470,12 @@ myRootLayer->Unlock();
|
|||||||
case AS_ACTIVATE_WINDOW:
|
case AS_ACTIVATE_WINDOW:
|
||||||
{
|
{
|
||||||
DTRACE(("ServerWindow %s: Message AS_ACTIVATE_WINDOW: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
DTRACE(("ServerWindow %s: Message AS_ACTIVATE_WINDOW: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
||||||
|
bool activate = true;
|
||||||
|
|
||||||
|
link.Read<bool>(&activate);
|
||||||
|
|
||||||
if (myRootLayer && myRootLayer->Lock()) {
|
if (myRootLayer && myRootLayer->Lock()) {
|
||||||
myRootLayer->SetActive(fWinBorder);
|
myRootLayer->SetActive(fWinBorder, activate);
|
||||||
myRootLayer->Unlock();
|
myRootLayer->Unlock();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -523,12 +523,7 @@ WinBorder::MouseDown(const BMessage *msg)
|
|||||||
|
|
||||||
// based on what the Decorator returned, properly place this window.
|
// based on what the Decorator returned, properly place this window.
|
||||||
if (action == DEC_MOVETOBACK) {
|
if (action == DEC_MOVETOBACK) {
|
||||||
Workspace::State oldWMState;
|
GetRootLayer()->SetActive(this, false);
|
||||||
GetRootLayer()->ActiveWorkspace()->GetState(&oldWMState);
|
|
||||||
|
|
||||||
GetRootLayer()->ActiveWorkspace()->MoveToBack(this);
|
|
||||||
|
|
||||||
GetRootLayer()->RevealNewWMState(oldWMState);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
GetRootLayer()->SetNotifyLayer(this, B_POINTER_EVENTS, 0UL);
|
GetRootLayer()->SetNotifyLayer(this, B_POINTER_EVENTS, 0UL);
|
||||||
|
|||||||
@@ -91,6 +91,20 @@
|
|||||||
# define STRACESTREAM() ;
|
# define STRACESTREAM() ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void
|
||||||
|
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);
|
||||||
|
if (l)
|
||||||
|
printf("\t %ld - %s\n", i, l->Name());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
/*!
|
/*!
|
||||||
\brief Creates a new Workspace object which has its own resolution and background color.
|
\brief Creates a new Workspace object which has its own resolution and background color.
|
||||||
|
|||||||
@@ -52,6 +52,9 @@ class Workspace {
|
|||||||
class State {
|
class State {
|
||||||
public:
|
public:
|
||||||
State() : Front(NULL), Focus(NULL), WindowList(50) { }
|
State() : Front(NULL), Focus(NULL), WindowList(50) { }
|
||||||
|
|
||||||
|
void PrintToStream();
|
||||||
|
|
||||||
WinBorder* Front;
|
WinBorder* Front;
|
||||||
WinBorder* Focus;
|
WinBorder* Focus;
|
||||||
WinBorder* Active;
|
WinBorder* Active;
|
||||||
|
|||||||
Reference in New Issue
Block a user