splitted SetActiveState() into 2 methods, since it was very messy
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21454 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -80,7 +80,9 @@ class BWindowScreen : public BWindow {
|
|||||||
status_t _InitData(uint32 space, uint32 attributes);
|
status_t _InitData(uint32 space, uint32 attributes);
|
||||||
void _DisposeData();
|
void _DisposeData();
|
||||||
|
|
||||||
status_t _SetActiveState(int32 state);
|
status_t _Activate();
|
||||||
|
status_t _Deactivate();
|
||||||
|
|
||||||
status_t _SetupAccelerantHooks(bool enable);
|
status_t _SetupAccelerantHooks(bool enable);
|
||||||
status_t _GetCardInfo();
|
status_t _GetCardInfo();
|
||||||
void _Suspend();
|
void _Suspend();
|
||||||
|
|||||||
@@ -341,7 +341,7 @@ BWindowScreen::Disconnect()
|
|||||||
if (fLockState == 1) {
|
if (fLockState == 1) {
|
||||||
if (fDebugState)
|
if (fDebugState)
|
||||||
fDebugFirst = true;
|
fDebugFirst = true;
|
||||||
_SetActiveState(0);
|
_Deactivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
be_app->ShowCursor();
|
be_app->ShowCursor();
|
||||||
@@ -354,7 +354,7 @@ BWindowScreen::WindowActivated(bool active)
|
|||||||
CALLED();
|
CALLED();
|
||||||
fWindowState = active;
|
fWindowState = active;
|
||||||
if (active && fLockState == 0 && fWorkState)
|
if (active && fLockState == 0 && fWorkState)
|
||||||
_SetActiveState(1);
|
_Activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -365,14 +365,14 @@ BWindowScreen::WorkspaceActivated(int32 ws, bool state)
|
|||||||
fWorkState = state;
|
fWorkState = state;
|
||||||
if (state) {
|
if (state) {
|
||||||
if (fLockState == 0 && fWindowState) {
|
if (fLockState == 0 && fWindowState) {
|
||||||
_SetActiveState(1);
|
_Activate();
|
||||||
if (!IsHidden()) {
|
if (!IsHidden()) {
|
||||||
Activate(true);
|
Activate(true);
|
||||||
WindowActivated(true);
|
WindowActivated(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (fLockState)
|
} else if (fLockState)
|
||||||
_SetActiveState(0);
|
_Deactivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -763,51 +763,56 @@ BWindowScreen::_DisposeData()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BWindowScreen::_SetActiveState(int32 state)
|
BWindowScreen::_Activate()
|
||||||
{
|
{
|
||||||
CALLED();
|
status_t status = _AssertDisplayMode(fDisplayMode);
|
||||||
status_t status = B_ERROR;
|
if (status < B_OK)
|
||||||
if (state == 1) {
|
return status;
|
||||||
status = _AssertDisplayMode(fDisplayMode);
|
|
||||||
if (status == B_OK && (status = _SetupAccelerantHooks(true)) == B_OK) {
|
|
||||||
if (!fActivateState) {
|
|
||||||
do {
|
|
||||||
status = acquire_sem(fActivateSem);
|
|
||||||
} while (status == B_INTERRUPTED);
|
|
||||||
|
|
||||||
if (status < B_OK)
|
status = _SetupAccelerantHooks(true);
|
||||||
return status;
|
if (status < B_OK)
|
||||||
}
|
return status;
|
||||||
|
|
||||||
SetColorList(fPalette);
|
if (!fActivateState) {
|
||||||
if (fDebugState && !fDebugFirst) {
|
do {
|
||||||
SuspensionHook(true);
|
status = acquire_sem(fActivateSem);
|
||||||
_Resume();
|
} while (status == B_INTERRUPTED);
|
||||||
} else {
|
|
||||||
fDebugFirst = true;
|
|
||||||
ScreenConnected(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status == B_OK)
|
if (status < B_OK)
|
||||||
return status;
|
return status;
|
||||||
} else
|
}
|
||||||
_SetupAccelerantHooks(false);
|
|
||||||
|
SetColorList(fPalette);
|
||||||
|
if (fDebugState && !fDebugFirst) {
|
||||||
|
SuspensionHook(true);
|
||||||
|
_Resume();
|
||||||
} else {
|
} else {
|
||||||
_AssertDisplayMode(fOriginalDisplayMode);
|
fDebugFirst = true;
|
||||||
|
ScreenConnected(true);
|
||||||
|
}
|
||||||
|
|
||||||
if (fDebugState && !fDebugFirst) {
|
return B_OK;
|
||||||
_Suspend();
|
}
|
||||||
SuspensionHook(false);
|
|
||||||
} else
|
|
||||||
ScreenConnected(false);
|
|
||||||
|
|
||||||
status = _SetupAccelerantHooks(false);
|
|
||||||
if (status == B_OK) {
|
status_t
|
||||||
be_app->ShowCursor();
|
BWindowScreen::_Deactivate()
|
||||||
if (fActivateState) {
|
{
|
||||||
// TODO: Set palette
|
_AssertDisplayMode(fOriginalDisplayMode);
|
||||||
}
|
|
||||||
|
if (fDebugState && !fDebugFirst) {
|
||||||
|
_Suspend();
|
||||||
|
SuspensionHook(false);
|
||||||
|
} else
|
||||||
|
ScreenConnected(false);
|
||||||
|
|
||||||
|
status_t status = _SetupAccelerantHooks(false);
|
||||||
|
if (status == B_OK) {
|
||||||
|
be_app->ShowCursor();
|
||||||
|
if (fActivateState) {
|
||||||
|
// TODO: reset palette
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user