cli: prevent --disable-gpu from bypassing the launcher

canvas: canvas glitches when hardware acceleration is disabled (--disable-gpu) (built-in gui only)
This commit is contained in:
bordun 2020-03-17 18:01:08 +01:00
parent 696a71a390
commit fe4589719c
5 changed files with 20 additions and 6 deletions

View file

@ -1,5 +1,13 @@
# Changelog
## 0.49.10
- bug fixes
- svg files not loading
- canvas glitches when hardware acceleration is disabled (--disable-gpu) (built-in gui only)
- misc
- prevent `--disable-gpu` from bypassing the launcher window
## 0.49.9

View file

@ -68,7 +68,7 @@ class Canvas extends Widget {
this.canvas = DOM.get(this.widget, 'canvas')[0]
this.ctx = this.canvas.getContext('2d',{
desynchronized: true,
desynchronized: ELECTRON_NOGPU ? false : true,
lowLatency: true,
alpha: true
})

View file

@ -10,6 +10,7 @@ if (settings.read('noVsync') || (!settings.cli && settings.read('argv')['disable
if (settings.read('noGpu') || (!settings.cli && settings.read('argv')['disable-gpu'])) {
app.disableHardwareAcceleration()
app._noGpu = true
}
if (settings.read('forceGpu') || (!settings.cli && settings.read('argv')['force-gpu'])) {

View file

@ -51,13 +51,18 @@ module.exports = function(options={}) {
shell.openExternal(url)
})
if (options.fullscreen) {
window.webContents.on('dom-ready', ()=>{
window.webContents.on('dom-ready', ()=>{
if (options.fullscreen) {
window.webContents.executeJavaScript(`
window.ELECTRON_FULLSCREEN = true
`)
})
}
}
if (app._noGpu) {
window.webContents.executeJavaScript(`
window.ELECTRON_NOGPU = true
`)
}
})
if (options.zoom === false) {
window.webContents.setVisualZoomLevelLimits(1, 1)

View file

@ -40,7 +40,7 @@ argv = argv.argv
// are we in a terminal ?
var cli = false,
ignored = ['_', '$0', 'no-sandbox', 'noSandbox']
ignored = ['_', '$0', 'no-sandbox', 'noSandbox', 'disable-gpu', 'disableGpu']
for (i in argv) {
if (!ignored.includes(i) && (argv[i]!=undefined && argv[i]!==false)) cli = true