Implement 'activiate' event instead of 'activate-with-open-windows'.
This commit is contained in:
parent
c006c4efa4
commit
377e7ee3a7
7 changed files with 20 additions and 14 deletions
|
@ -171,8 +171,8 @@ void App::OnActivateWithNoOpenWindows() {
|
||||||
Emit("activate-with-no-open-windows");
|
Emit("activate-with-no-open-windows");
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::OnActivateWithOpenWindows() {
|
void App::OnActivate(bool hasVisibleWindows) {
|
||||||
Emit("activate-with-open-windows");
|
Emit("activate", hasVisibleWindows);
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::OnWillFinishLaunching() {
|
void App::OnWillFinishLaunching() {
|
||||||
|
|
|
@ -42,7 +42,7 @@ class App : public mate::EventEmitter,
|
||||||
void OnOpenFile(bool* prevent_default, const std::string& file_path) override;
|
void OnOpenFile(bool* prevent_default, const std::string& file_path) override;
|
||||||
void OnOpenURL(const std::string& url) override;
|
void OnOpenURL(const std::string& url) override;
|
||||||
void OnActivateWithNoOpenWindows() override;
|
void OnActivateWithNoOpenWindows() override;
|
||||||
void OnActivateWithOpenWindows() override;
|
void OnActivate(bool hasVisibleWindows) override;
|
||||||
void OnWillFinishLaunching() override;
|
void OnWillFinishLaunching() override;
|
||||||
void OnFinishLaunching() override;
|
void OnFinishLaunching() override;
|
||||||
void OnSelectCertificate(
|
void OnSelectCertificate(
|
||||||
|
|
|
@ -98,8 +98,8 @@ void Browser::ActivateWithNoOpenWindows() {
|
||||||
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnActivateWithNoOpenWindows());
|
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnActivateWithNoOpenWindows());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Browser::ActivateWithOpenWindows() {
|
void Browser::Activate(bool hasVisibleWindows) {
|
||||||
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnActivateWithOpenWindows());
|
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnActivate(hasVisibleWindows));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Browser::WillFinishLaunching() {
|
void Browser::WillFinishLaunching() {
|
||||||
|
|
|
@ -111,8 +111,9 @@ class Browser : public WindowListObserver {
|
||||||
// Tell the application that application is activated with no open windows.
|
// Tell the application that application is activated with no open windows.
|
||||||
void ActivateWithNoOpenWindows();
|
void ActivateWithNoOpenWindows();
|
||||||
|
|
||||||
// Tell the application that application is activated with open windows.
|
// Tell the application that application is activated with visible/invisible
|
||||||
void ActivateWithOpenWindows();
|
// windows.
|
||||||
|
void Activate(bool hasVisibleWindows);
|
||||||
|
|
||||||
// Tell the application the loading has been done.
|
// Tell the application the loading has been done.
|
||||||
void WillFinishLaunching();
|
void WillFinishLaunching();
|
||||||
|
|
|
@ -47,9 +47,9 @@ class BrowserObserver {
|
||||||
// dock icon).
|
// dock icon).
|
||||||
virtual void OnActivateWithNoOpenWindows() {}
|
virtual void OnActivateWithNoOpenWindows() {}
|
||||||
|
|
||||||
// The browser is activated with open windows (usually by clicking on the dock
|
// The browser is activated with visible/invisible windows (usually by
|
||||||
// icon).
|
// clicking on the dock icon).
|
||||||
virtual void OnActivateWithOpenWindows() {}
|
virtual void OnActivate(bool hasVisibleWindows) {}
|
||||||
|
|
||||||
// The browser has finished loading.
|
// The browser has finished loading.
|
||||||
virtual void OnWillFinishLaunching() {}
|
virtual void OnWillFinishLaunching() {}
|
||||||
|
|
|
@ -52,8 +52,8 @@
|
||||||
- (BOOL)applicationShouldHandleReopen:(NSApplication*)theApplication
|
- (BOOL)applicationShouldHandleReopen:(NSApplication*)theApplication
|
||||||
hasVisibleWindows:(BOOL)flag {
|
hasVisibleWindows:(BOOL)flag {
|
||||||
atom::Browser* browser = atom::Browser::Get();
|
atom::Browser* browser = atom::Browser::Get();
|
||||||
|
browser->Activate(static_cast<bool>(flag));
|
||||||
if (flag) {
|
if (flag) {
|
||||||
browser->ActivateWithOpenWindows();
|
|
||||||
return YES;
|
return YES;
|
||||||
} else {
|
} else {
|
||||||
browser->ActivateWithNoOpenWindows();
|
browser->ActivateWithNoOpenWindows();
|
||||||
|
|
|
@ -100,10 +100,15 @@ Emitted when the application is activated while there are no open windows, which
|
||||||
usually happens when the user has closed all of the application's windows and
|
usually happens when the user has closed all of the application's windows and
|
||||||
then clicks on the application's dock icon.
|
then clicks on the application's dock icon.
|
||||||
|
|
||||||
### Event: activated-with-open-windows _OS X_
|
### Event: 'activate' _OS X_
|
||||||
|
|
||||||
Emitted when the application is activated while there are open windows, which
|
Returns:
|
||||||
usually happens when clicks on the applications's dock icon.
|
|
||||||
|
* `event` Event
|
||||||
|
* `hasVisibleWindows` Bool
|
||||||
|
|
||||||
|
Emitted when the application is activated, which usually happens when clicks on
|
||||||
|
the applications's dock icon.
|
||||||
|
|
||||||
### Event: 'browser-window-blur'
|
### Event: 'browser-window-blur'
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue