steamworks.js
steamworks.js copied to clipboard
Alt-tabbing sometimes creates duplicate "ghost" windows
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:
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-compositionfrom being appended.
I'm happy to add a PR for the latter but the former will require someone who knows the whys.
Hey, which version of electron are you using to reproduce this?
@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).
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.