b994ae8174
OS X's application termination doesn't work very well with C++ message loops. Especially when we return NSTerminateLater for shouldTerminate, it would be impossible for the C++ message loop to quit, because unless we explictly let NSApp terminate the application, the message loop would think the application is not terminated and will run forever. The fix is to simply ignore the Cocoa's application termination request and let the C++ message loop deal with it compeletey. But we had the side effect that atom-shell would always cancel OS X's shutdown request, this is also the approach chosen by Chromium. Fixes #229. Fixes atom/atom#1864.
35 lines
859 B
C++
35 lines
859 B
C++
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "atom/browser/browser.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "atom/browser/native_window.h"
|
|
#include "atom/browser/window_list.h"
|
|
#include "atom/common/atom_version.h"
|
|
|
|
namespace atom {
|
|
|
|
void Browser::Focus() {
|
|
// Focus on the first visible window.
|
|
WindowList* list = WindowList::GetInstance();
|
|
for (WindowList::iterator iter = list->begin(); iter != list->end(); ++iter) {
|
|
NativeWindow* window = *iter;
|
|
if (window->IsVisible()) {
|
|
window->Focus(true);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
std::string Browser::GetExecutableFileVersion() const {
|
|
return ATOM_VERSION_STRING;
|
|
}
|
|
|
|
std::string Browser::GetExecutableFileProductName() const {
|
|
return "Atom-Shell";
|
|
}
|
|
|
|
} // namespace atom
|