예제 #1
0
void HumanClientApp::HandleFocusChange() {
    DebugLogger() << "HumanClientApp::HandleFocusChange()";

    // TODO: Does SDL need some action here?

    CancelDragDrop();
    ClearEventState();
}
예제 #2
0
void HumanClientApp::HandleFocusChange(bool gained_focus) {
    DebugLogger() << "HumanClientApp::HandleFocusChange("
                  << (gained_focus ? "Gained Focus" : "Lost Focus")
                  << ")";

    m_have_window_focus = gained_focus;

    // limit rendering frequency when defocused to limit CPU use
    if (!m_have_window_focus) {
        if (GetOptionsDB().Get<bool>("limit-fps-no-focus"))
            this->SetMaxFPS(GetOptionsDB().Get<double>("max-fps-no_focus"));
        else
            this->SetMaxFPS(0.0);
    } else {
        if (GetOptionsDB().Get<bool>("limit-fps"))
            this->SetMaxFPS(GetOptionsDB().Get<double>("max-fps"));
        else
            this->SetMaxFPS(0.0);
    }

    CancelDragDrop();
    ClearEventState();
}