Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(De)activation is not working in ReactiveWindowControler #696

Merged
merged 2 commits into from
Aug 8, 2014
Merged

(De)activation is not working in ReactiveWindowControler #696

merged 2 commits into from
Aug 8, 2014

Conversation

mteper
Copy link
Contributor

@mteper mteper commented Aug 8, 2014

We now listen for window is closing notifications and triggering deactivation.

// notification to support (de)activation
NSNotificationCenter
.DefaultCenter
.AddObserver(NSWindow.WillCloseNotification, _ => deactivated.OnNext(Unit.Default));
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't this subscribe to any Window being closed? We only want to deactivate when this Window is being closed

Copy link
Member

Choose a reason for hiding this comment

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

That is what I was thinking too. But it seems you can register for notifications from the current window according to the docs. https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Notifications/Articles/Registering.html. Does AddObserver have another overload?

Copy link
Member

Choose a reason for hiding this comment

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

Does this look right? @mteper can you give this a go?

NSNotificationCenter.DefaultCenter
    .AddObserver(NSWindow.WillCloseNotification, _ => deactivated.OnNext(Unit.Default), this);

If not we have to start registering selectors and shit to make this work :-/

@mteper
Copy link
Contributor Author

mteper commented Aug 8, 2014

Yup, you guys were right, I missed the filtering bit. Now corrected.

Thanks!

anaisbetts pushed a commit that referenced this pull request Aug 8, 2014
(De)activation is not working in ReactiveWindowControler
@anaisbetts anaisbetts merged commit 037d1e6 into reactiveui:master Aug 8, 2014
@anaisbetts
Copy link
Member

Thanks @mteper!

@lock lock bot locked and limited conversation to collaborators Jun 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants