| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 The Native Client Authors. All rights reserved. | 2 * Copyright 2015 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 /* globals NaClTerm, NaClProcessManager */ |
| 8 |
| 9 'use strict'; |
| 10 |
| 7 NaClTerm.nmf = 'Xsdl.nmf'; | 11 NaClTerm.nmf = 'Xsdl.nmf'; |
| 8 NaClTerm.argv = [ | 12 NaClTerm.argv = [ |
| 9 '-screen', '1140x810x32', '-ac', '-br', '-noreset', ':42' | 13 '-screen', '1140x810x32', '-ac', '-br', '-noreset', ':42' |
| 10 ]; | 14 ]; |
| 11 NaClTerm.env = [ | 15 NaClTerm.env = [ |
| 12 'NACL_SPAWN_MODE=embed', | 16 'NACL_SPAWN_MODE=embed', |
| 13 'NACL_EMBED_WIDTH=100%', | 17 'NACL_EMBED_WIDTH=100%', |
| 14 'NACL_EMBED_HEIGHT=100%', | 18 'NACL_EMBED_HEIGHT=100%', |
| 15 ]; | 19 ]; |
| 16 document.title = 'Loading ... (this may take a while)'; | 20 document.title = 'Loading ... (this may take a while)'; |
| 17 | 21 |
| 18 var mgr = new NaClProcessManager(); | 22 var mgr = new NaClProcessManager(); |
| 19 mgr.onTerminalResize(80, 24); | 23 mgr.onTerminalResize(80, 24); |
| 20 var env = [ | 24 var env = [ |
| 21 'DISPLAY=:42', | 25 'DISPLAY=:42', |
| 22 ]; | 26 ]; |
| 23 | 27 |
| 24 // TODO(bradnelson): Do something more robust than racing gtk + xserver. | 28 // TODO(bradnelson): Do something more robust than racing gtk + xserver. |
| 25 function startDemo() { | 29 function startDemo() { |
| 26 // Assume a default terminal size for headless processes. | 30 // Assume a default terminal size for headless processes. |
| 27 mgr.spawn( | 31 mgr.spawn( |
| 28 'gimp.nmf', [ '-f','--no-shm', '--display=:42','--no-cpu-accel', | 32 'gimp.nmf', [ '-f','--no-shm', '--display=:42','--no-cpu-accel', |
| 29 '--new-instance',], env, '/', 'nacl', null, function(pid) { | 33 '--new-instance',], env, '/', 'nacl', null, function(pid) { |
| 30 mgr.waitpid(pid, 0, function() { | 34 mgr.waitpid(pid, 0, function() { |
| 31 window.close(); | 35 window.close(); |
| 32 }); | 36 }); |
| 33 }); | 37 }); |
| 34 window.setTimeout(function(){document.title = 'Gimp'}, 25000); | 38 window.setTimeout(function() { document.title = 'Gimp'; }, 25000); |
| 35 } | 39 } |
| 36 | 40 |
| 37 function startWindowManager() { | 41 function startWindowManager() { |
| 38 mgr.spawn( | 42 mgr.spawn( |
| 39 'twm.nmf', [""], env, | 43 'twm.nmf', [""], env, |
| 40 '/', 'nacl', null, function(pid) { | 44 '/', 'nacl', null, function(pid) { |
| 41 mgr.waitpid(pid, 0, function() { | 45 mgr.waitpid(pid, 0, function() { |
| 42 window.close(); | 46 window.close(); |
| 43 }); | 47 }); |
| 44 }); | 48 }); |
| 45 } | 49 } |
| 46 | 50 |
| 47 startDemo(); | 51 startDemo(); |
| 48 window.setTimeout(function() {startWindowManager()}, 5000); | 52 window.setTimeout(startWindowManager, 5000); |
| OLD | NEW |