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

Phantom windows created by app Optimus Player #200

Closed
ghost opened this issue Apr 2, 2020 · 14 comments
Closed

Phantom windows created by app Optimus Player #200

ghost opened this issue Apr 2, 2020 · 14 comments
Labels
bug Something isn't working unreproducible Need help from the author to reproduce the issue

Comments

@ghost
Copy link

ghost commented Apr 2, 2020

The app Optimus Player is creating phantom windows. I've attached a screen shot with a single real window and a single window that doesn't actually exist. If I try switching to it (even from another app such as Finder), nothing happens. At one point I had over 5 of these fake windows showing up in alt-tab.

If relevant, the developer of Optimus player can be contacted at [email protected].

Screen Shot

@lwouis lwouis added the bug Something isn't working label Apr 2, 2020
@lwouis lwouis changed the title Bug - phantom windows created by app Optimus Player Phantom windows created by app Optimus Player Apr 2, 2020
@lwouis lwouis added the unreproducible Need help from the author to reproduce the issue label Apr 2, 2020
@lwouis
Copy link
Owner

lwouis commented Apr 2, 2020

@ezity thanks for the feedback! I think this issue was fixed in a recent release. Which version are you using? Could you try the latest?

I downloaded Optimus Player and tried it, and everything is working smoothly:

Screen Shot 2020-04-02 at 20 12 35

image

@ghost
Copy link
Author

ghost commented Apr 2, 2020

@lwouis I am running 3.2.1.

I see that 3.3.0 was released today so I am upgrading now and will see what happens.

@lwouis
Copy link
Owner

lwouis commented Apr 2, 2020

@ezity 2 users are having 3.3.0 crash right at startup for them. Could you please share if it is crashing for you to? I'm curious if only my machine is not affected (doesn't crash on my machine), or if it's specific to a few users.

@ghost
Copy link
Author

ghost commented Apr 2, 2020

@lwouis A simple test on 3.3.0 doesn't seem to exhibit this behavior. For now I will close this issue, and if I notice similar behavior in the future I will re-open it.

Re crashing, I haven't had an issue. Do you mean startup of the machine or launch of the app? I can restart my computer and see if I have an issue then. Maybe it is best to discuss in #202 ?

@ghost ghost closed this as completed Apr 2, 2020
@lwouis
Copy link
Owner

lwouis commented Apr 2, 2020

Thank you very much @ezity! Don't hesitate to re-open that issue if the strange buggy window happens again. I remember seeing similar things in the past. It had to do with very complex macOS Accessiblity API subscription retries. A nightmare I thought I finally put in a coffin. Let me know if the monster is still alive ;p

@ghost ghost reopened this Apr 4, 2020
@ghost
Copy link
Author

ghost commented Apr 4, 2020

@lwouis I've re-opened this issue, as the behavior is still occurring on 3.4.

@lwouis
Copy link
Owner

lwouis commented Apr 7, 2020

I'm trying to reproduce the issue on my machine without success. Could you please give me more clues?

  • When did it start happening for you? Did it happen while AltTab's UI was showing, or it was not there, then you invoked AltTab UI and noticed the buggy window being listed?
  • Is it connected to any action your did within Optimus Player like open a movie there, open the preferences, check for updates?
  • Does it happen again if you quit and launch the app again?

If I can't reproduce, it's pretty much impossible to understand the issue and fix it

@ghost
Copy link
Author

ghost commented Apr 7, 2020

When I get it into whatever state it is that causes this issue, every video opened and then closed will cause another fake window to be listed in AltTab. However, I am finding it hard to reproduce on my end as well. I'm not sure what gets it to start this behavior.

I will try to pay more careful attention and see what triggers this whole thing in the first place.

@lwouis
Copy link
Owner

lwouis commented Apr 18, 2020

@ezity any luck reproducing the issue?

@ghost
Copy link
Author

ghost commented Apr 19, 2020

@lwouis Reliably? No. However, it's definitely still occurring. I mostly watch long videos in full-screen mode using the app, and haven't been able to reproduce it from just opening and closing videos quickly. Maybe it somehow only triggers after a set period of time?

I understand that I haven't provided enough information to actually fix this bug (which may even be a bug in Optimus Player), so it might be a good idea to close this (again) until I can figure out how to reliably reproduce it.

@lwouis
Copy link
Owner

lwouis commented Apr 20, 2020

I fixed #236 recently, and here is what happens behind the scenes:

AltTab uses the macOS accessibility APIs to find which windows are open. The problem is that apps don't have to respect these APIs. Steam for instance is ported from Windows, so all its windows are flagged as AXUnknown instead of AXStandardWindow for instance. AltTab has rules to filter windows that the user would consider windows, as opposed to windows that don't look like windows. In the Steam example, the dropdown menus when you over some sections are coded as NSWindows. So without any filtering on AltTab side, they would appear in the thumbnails as windows, which makes no sense for the end-user.

My point being that it's possible that Optimus Player has some bugs which leads it to generate fake windows, here even invisible windows that serve who-knows-which purpose, like maybe they have a 1% opacity fake window covering the whole screen to dim it, or some other technical trickery to leads AltTab to display a no-thumbnail window in the thumbnails.

The only way to dig deeper here is to reproduce the issue, then look at how the window looks like at the technical level (i.e. what are its role, subrole, title, etc, from the Accessibility API). They we would think about how to filter it out, if it's possible.

@ghost
Copy link
Author

ghost commented Apr 20, 2020

@lwouis If I can't manage to reproduce it consistently, but I can reproduce it on my machine, can I get that technical info from the Accessibility API when the issue does appear? Some way to save all accessibility info from a specific window?

@lwouis
Copy link
Owner

lwouis commented Apr 20, 2020

Yes, you can get that by printing characteristics of the window when they get tested in this function:

let subrole_ = subrole()

You can add a line like this:

debugPrint(title(), role(), subrole(), isOnNormalLevel())

However, it may be possible that the window is initially valid when passing through this filtering method, but then later it changes its attributes and because a garbage window. A way to just view the windows listed in the thumbnail panel is to put a breakpoint anywhere in the main trigger function like on this line:

https://github.com/lwouis/alt-tab-macos/blob/master/src/ui/App.swift#L197

Then once you have stopped execution, you can inspect the value of Windows.list which has all the windows that AltTab is observing, coming from the OS Accessibility API, and filtered by the method I linked above. In that list you can again list the windows, with their characteristics, like so:

Windows.list.map { ($0.application.runningApplication.bundleIdentifier, $0.axUiElement.title(), $0.axUiElement.role(), $0.axUiElement.subrole(), $0.axUiElement.isOnNormalLevel()) }

This will show you the list of windows AltTab is tracking, with the app bundle they belong to, and their accessibility characteristics.

If you share your findings here, this will certainly help understand why AltTab is showing a buggy windows which is not user-visible.

lwouis pushed a commit that referenced this issue May 6, 2020
# [3.19.0](v3.18.0...v3.19.0) (2020-05-06)

### Bug Fixes

* don't display invalid windows (may fix [#292](#292) [#200](#200)) ([1bca012](1bca012))
* don't display tabbed windows (closes [#258](#258)) ([8419ad9](8419ad9))
* update french localization ([445980a](445980a))

### Features

* add dutch localization ([b8eb0b4](b8eb0b4))
* add preference: show standard tabs as windows ([3a11cc6](3a11cc6))
@lwouis
Copy link
Owner

lwouis commented May 11, 2020

@ezity I think with last week's changes to the code, this issue will not happen again. I'll close this ticket. Please comment here if somehow it happens to you again, then I'll re-open of course! I think it should be gone now though 👍

@lwouis lwouis closed this as completed May 11, 2020
lwouis added a commit that referenced this issue May 21, 2020
Revert "fix: don't display invalid windows (may fix #292 #200)"

This reverts commit 1bca012
lwouis added a commit that referenced this issue May 21, 2020
Revert "fix: don't display invalid windows (may fix #292 #200)"

This reverts commit 1bca012
lwouis pushed a commit that referenced this issue May 21, 2020
# [3.24.0](v3.23.2...v3.24.0) (2020-05-21)

### Bug Fixes

* don't freeze when invoked while unity is recompiling (closes [#342](#342)) ([41cb701](41cb701)), closes [#292](#292) [#200](#200)
* don't freeze when sending a command to an frozen window ([408b800](408b800))
* show windows which are opened in fullscreen (closes [#335](#335)) ([2674c8f](2674c8f))

### Features

* show indicator for fullscreen windows ([0138cd1](0138cd1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unreproducible Need help from the author to reproduce the issue
Projects
None yet
Development

No branches or pull requests

1 participant