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

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

Open
EvidentlyCube opened this issue May 23, 2023 · 3 comments
Open

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

EvidentlyCube opened this issue May 23, 2023 · 3 comments

Comments

@EvidentlyCube
Copy link

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.

@ceifa
Copy link
Owner

ceifa commented Jul 4, 2023

Hey, which version of electron are you using to reproduce this?

@EvidentlyCube
Copy link
Author

@ceifa The version I have in package.json is 23.1.3 with electron-packager on version 17.1.1 (though I don't suppose the latter matters).

@ceifa
Copy link
Owner

ceifa commented Jul 4, 2023

The disable-direct-composition is used to disable Microsoft DirectComposition. It being enable can cause weird render behaviors on the overlay over windows.

Maybe this is not a issue anymore on the newest versions... I will try remove it later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants