Alt-tab-macos: Phantom windows created by app Optimus Player

Created on 2 Apr 2020  路  14Comments  路  Source: lwouis/alt-tab-macos

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

bug unreproducible

All 14 comments

@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

@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.

@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.

@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 ?

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

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

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

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.

@ezity any luck reproducing the issue?

@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.

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.

@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?

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

https://github.com/lwouis/alt-tab-macos/blob/156957c3762e6b3f45007d5581a8499b240ac81b/src/api-wrappers/AXUIElement.swift#L24

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.

@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 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mfn picture mfn  路  4Comments

gingerr picture gingerr  路  6Comments

lwouis picture lwouis  路  3Comments

Stokestack picture Stokestack  路  5Comments

johanan-daniel picture johanan-daniel  路  6Comments