Skip to content

Alt-tabbing sometimes creates duplicate "ghost" windows #95

@EvidentlyCube

Description

@EvidentlyCube

I've got an interesting problem and I am 95% sure it's related to the library.

When I use the library, using Alt+Tab on Win 11 sometimes causes a duplicate ghost window to appear:
image

There are three proper windows for Trans Neuronica here, even though it really is only a single one. Closing it will cause blank pseudo-apps to remain in there, same as you can see in the second row. The issue is very finicky to replicate though so it's possible that I was just lucky and it has nothing to do with it. Nevertheless, here are results from some of my attempts:

electronEnableSteamOverlay(false)

const x = require('./steamworks.js/index.js');
x.electronEnableSteamOverlay(false);
console.log(x);

Successfully duplicated a ghost after a few dozen of alt tabs

electronEnableSteamOverlay(true)

const x = require('./steamworks.js/index.js');
x.electronEnableSteamOverlay(true);
console.log(x);

Successfully duplicated a ghost after a few alt tabs

Comment out both appendSwitch()

const x = require('./steamworks.js/index.js');
x.electronEnableSteamOverlay(true);
console.log(x);

And I commented out the following two lines in index.js:

//electron.app.commandLine.appendSwitch('in-process-gpu')
//electron.app.commandLine.appendSwitch('disable-direct-composition')

Failed to duplicate a ghost after dozens of tries.
But also it's impossible to show the steam overlay.

Comment out in-process-gpu

const x = require('./steamworks.js/index.js');
x.electronEnableSteamOverlay(true);
console.log(x);

And I commented out one of the lines in index.js:

//electron.app.commandLine.appendSwitch('in-process-gpu')
electron.app.commandLine.appendSwitch('disable-direct-composition')

Duplicated a ghost after a few tries.
But also it's impossible to show the steam overlay.

Comment out disable-direct-composition

const x = require('./steamworks.js/index.js');
x.electronEnableSteamOverlay(true);
console.log(x);

And I commented out one of the lines in index.js:

electron.app.commandLine.appendSwitch('in-process-gpu')
//electron.app.commandLine.appendSwitch('disable-direct-composition')

Failed to duplicate a ghost after dozens of alt tabs.
And steam overlay seems to work correctly.

Summary

It seems that disable-direct-composition causes the issue and doesn't seem to be required at a first glance. I am sure that command wasn't added for no reason, so it would be great if:

  • Comments were added to explain why both switches are added (as well as what exactly is the purpose of frame invalidation)
  • And have a way to prevent disable-direct-composition from being appended.

I'm happy to add a PR for the latter but the former will require someone who knows the whys.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions