Force enable WebGL on Electron/Linux

This commit is contained in:
Joshua Granick
2018-08-06 14:47:07 -07:00
parent 6753c6d3ca
commit 9bbfd40f8b

View File

@@ -2,11 +2,13 @@ import electron.main.App;
import electron.main.BrowserWindow; import electron.main.BrowserWindow;
class ElectronSetup { class ElectronSetup {
public static var window:BrowserWindow; public static var window:BrowserWindow;
static function main() static function main()
{ {
electron.main.App.commandLine.appendSwitch('ignore-gpu-blacklist', 'true');
var windows:Array<OpenFLWindow> = [ var windows:Array<OpenFLWindow> = [
::foreach windows:: ::foreach windows::
{ {
@@ -34,8 +36,8 @@ class ElectronSetup {
y: ::y:: y: ::y::
},::end:: },::end::
]; ];
for (i in 0...windows.length) for (i in 0...windows.length)
{ {
var window:OpenFLWindow = windows[i]; var window:OpenFLWindow = windows[i];
var width:Int = window.width; var width:Int = window.width;
@@ -43,22 +45,24 @@ class ElectronSetup {
if (width < 1200) width = 1200; if (width < 1200) width = 1200;
if (height < 800) height = 800; if (height < 800) height = 800;
var frame:Bool = window.borderless == false; var frame:Bool = window.borderless == false;
electron.main.App.on( 'ready', function(e) { electron.main.App.on( 'ready', function(e) {
ElectronSetup.window = new BrowserWindow( { var config:Dynamic = {
fullscreen: window.fullscreen, fullscreen: window.fullscreen,
frame:frame, frame:frame,
resizable: window.resizable, resizable: window.resizable,
alwaysOnTop: window.alwaysOnTop, alwaysOnTop: window.alwaysOnTop,
width:width, width:width,
height:height height:height,
} ); webgl:window.hardware
};
ElectronSetup.window = new BrowserWindow(config);
ElectronSetup.window.on( closed, function() { ElectronSetup.window.on( closed, function() {
if( js.Node.process.platform != 'darwin' ) if( js.Node.process.platform != 'darwin' )
electron.main.App.quit(); electron.main.App.quit();
}); });
ElectronSetup.window.loadURL( 'file://' + js.Node.__dirname + '/index.html' ); ElectronSetup.window.loadURL( 'file://' + js.Node.__dirname + '/index.html' );
#if debug #if debug
ElectronSetup.window.webContents.openDevTools(); ElectronSetup.window.webContents.openDevTools();