-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
31 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
e602a57
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice to see you gave this idea a go!
I don't have any experience with that notification and I couldn't decipher its documentation, but just from looking at this commit I can't see any logic checking whether the space that was switched to is actually the one containing the window in question (in which case a switch to PiP is undesirable). Is such a check not necessary?
Also, was this tested with more than one monitor?
Edit: I also imagined a check to see whether the space that was switched from is actually the one containing the window. Otherwise a PiP window would just magically appear if you e.g. resumed a non-visible video with your media keys and then proceeded to navigate to it by switching spaces. I.e. the desire to switch to PiP should, in my opinion, only be inferred if the window starts out being visible at the point of switching spaces.
e602a57
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commit contains another issue: entering full screen is also considered as changing space, so it will enter pip mode.
e602a57
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You bring up some good points. When I wrote this I didn't think these checks were necessary, as I had thought that the only way to get this notification to fire would be to exit the current space (otherwise you'd already have the PiP window floating around), but there are ways to make this condition break down so the checks are actually needed. Let me fix that.
Nope, I don't have an external monitor to test on :(
e602a57
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that does sound like a problem.
While searching for a better description of the notification I came across someone saying that entering mission control was also considered a switch. It sounds pretty messy.
e602a57
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a NSWindow's property called
isVisible
, which might be useful for our case, tho I haven't tried it. Documentation says:e602a57
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I should actually revert this commit, honestly: I was a bit too hasty in pushing it out. The API that something like this would need to behave correctly (namely, being able to observe the current space) is not public, at least based on what I could see in in Apple's documentation. I'll come back around to this once I can poke into how Dock and Skylight work.
e602a57
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have reverted this commit: cf0d271.
e602a57
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget to reopen #2326 :)