Skip to content

Implement 'activate' event for app. - #2777

Merged
zcbenz merged 5 commits into
masterfrom
dock-clicked
Sep 15, 2015
Merged

zcbenz merged 5 commits into
masterfrom
dock-clicked

Conversation

@hokein

@hokein hokein commented Sep 14, 2015

Copy link
Copy Markdown
Contributor

Fixes #2671 .

@zcbenz

zcbenz commented Sep 14, 2015

Copy link
Copy Markdown
Contributor

I think we can just add an activate event with a hasVisibleWindows parameter, and then deprecate the activate-with-no-open-windows event.

@lipis

lipis commented Sep 14, 2015

Copy link
Copy Markdown

Yes please 🌴 👍

Comment thread docs/api/app.md Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

include in quotes for consistency: '

@hokein hokein changed the title Implement 'activate-with-open-windows' event for app. Implement 'activate' event for app. Sep 15, 2015
@hokein

hokein commented Sep 15, 2015

Copy link
Copy Markdown
Contributor Author

@zcbenz Done.

Comment thread atom/browser/api/atom_api_app.cc Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In C++ we need to use the has_visible_windows style of variable names.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I missed it. Done.

Comment thread atom/browser/api/lib/app.coffee Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably emit activate directly in C++ and implement activate-with-no-open-windows like this:

app.on 'activate', (event, hasVisibleWindows) -> @emit 'activate-with-no-open-windows' if hasVisibleWindows

So we can put activate-with-no-open-windows with other deprecated APIs together, and we don't need to have a _activate event.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@zcbenz

zcbenz commented Sep 15, 2015

Copy link
Copy Markdown
Contributor

Thanks!

zcbenz added a commit that referenced this pull request Sep 15, 2015
Implement 'activate' event for app.
@zcbenz
zcbenz merged commit fe2219a into master Sep 15, 2015
@zcbenz
zcbenz deleted the dock-clicked branch September 15, 2015 03:17
@tommoor

tommoor commented Sep 15, 2015

Copy link
Copy Markdown
Contributor

Kick ass 😄 👢

enrique-ramirez added a commit to enrique-ramirez/N1 that referenced this pull request Nov 27, 2015
As mentioned on this Electron's issue: electron/electron#2777

The 'activate-with-open-windows' event has been deprecated in favor of a global 'activate' event with a 'hasVisibleWindows' parameter.

This fixes Nylas from crashing when closing the main window and opening via clicking the Dock icon.
@paulius005

Copy link
Copy Markdown
Contributor

Just came here to say thanks for doing this :)

Was a really useful option for us to have!

@@ -52,12 +52,8 @@ - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender
- (BOOL)applicationShouldHandleReopen:(NSApplication*)theApplication
hasVisibleWindows:(BOOL)flag {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why it was implemented with applicationShouldHandleReopen instead of applicationDidBecomeActive ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants