1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-12 14:23:40 +00:00

1. Updated macOS message-box to correctly detect cancel button press

2. Fixed compiler warning
3. Updated --no-embedded=1 detection
This commit is contained in:
Bryan Roe
2020-08-02 15:48:15 -07:00
parent 9931cdd9e1
commit b40b4f45e6
4 changed files with 23 additions and 11 deletions

View File

@@ -113,7 +113,7 @@ char* crashMemory = ILib_POSIX_InstallCrashHandler(argv[0]);
int i; int i;
for (i = 1; i < argc; ++i) for (i = 1; i < argc; ++i)
{ {
if (strcmp(argv[i], "--no-embedded=1") == 0) if (strcmp(argv[i], "--no-embedded=1") == 0 || strcmp(argv[i], "--no-embedded=\"1\"") == 0)
{ {
free(integratedJavaScript); free(integratedJavaScript);
integratedJavaScript = NULL; integratedJavaScript = NULL;

View File

@@ -15,7 +15,7 @@ limitations under the License.
*/ */
#include "linux_compression.h" #include "linux_compression.h"
#include "../../../microstack/ILibParsers.h"; #include "../../../microstack/ILibParsers.h"
#if defined(JPEGMAXBUF) #if defined(JPEGMAXBUF)
#define MAX_TILE_SIZE JPEGMAXBUF #define MAX_TILE_SIZE JPEGMAXBUF

File diff suppressed because one or more lines are too long

View File

@@ -635,12 +635,19 @@ function macos_messageBox()
this.create = function create(title, caption, timeout, layout) this.create = function create(title, caption, timeout, layout)
{ {
var userLayout = Array.isArray(layout);
caption = caption.split('\n').join('\\n'); caption = caption.split('\n').join('\\n');
if (Array.isArray(layout) && layout.length > 3) { throw ('This system only supports a maximum of 3 buttons'); } if (Array.isArray(layout) && layout.length > 3)
{
ret = new promise(function (res, rej) { this._res = res; this._rej = rej; });
ret._rej('This system only supports a maximum of 3 buttons');
return (ret);
}
if (require('user-sessions').isRoot()) if (require('user-sessions').isRoot())
{ {
ret = new promise(function (res, rej) { this._res = res; this._rej = rej; }); ret = new promise(function (res, rej) { this._res = res; this._rej = rej; });
try try
{ {
ret.uid = require('user-sessions').consoleUid(); ret.uid = require('user-sessions').consoleUid();
@@ -651,15 +658,13 @@ function macos_messageBox()
ret._rej('No users logged in'); ret._rej('No users logged in');
return (ret); return (ret);
} }
ret.user = (layout != null && typeof (layout) == 'object') ? true : false; ret.user = userLayout;
if (layout == null) if (layout == null)
{ {
userLayout = false;
layout = ['Yes', 'No']; layout = ['Yes', 'No'];
} }
else if (typeof (layout) != 'object') else if (typeof (layout) != 'object')
{ {
userLayout = false;
layout = ['OK']; layout = ['OK'];
} }
@@ -674,9 +679,10 @@ function macos_messageBox()
ret.child.descriptorMetadata = 'message-box'; ret.child.descriptorMetadata = 'message-box';
ret.child.promise = ret; ret.child.promise = ret;
ret.child.stdout.str = ''; ret.child.stdout.on('data', function (c) { this.str += c.toString(); }); ret.child.stdout.str = ''; ret.child.stdout.on('data', function (c) { this.str += c.toString(); });
ret.child.on('exit', function () ret.child.on('exit', function (code)
{ {
var res = this.stdout.str.split('\x1e'); var res = this.stdout.str.split('\x1e');
if (this.promise.user && !res[1]) { this.promise._res('Cancel'); }
if (!res[1]) { return; } if (!res[1]) { return; }
res = res[1].trim(); res = res[1].trim();
if (res == '_TIMEOUT_') if (res == '_TIMEOUT_')
@@ -707,7 +713,6 @@ function macos_messageBox()
} }
// Start Local Server // Start Local Server
var ret = this._initIPCBase(); var ret = this._initIPCBase();
ret.metadata = 'message-box/create' ret.metadata = 'message-box/create'
@@ -716,7 +721,7 @@ function macos_messageBox()
{ {
ret.layout = ['Yes', 'No']; ret.layout = ['Yes', 'No'];
} }
else if(typeof(layout)!='object') else if(!Array.isArray(layout))
{ {
ret.layout = ['OK']; ret.layout = ['OK'];
} }
@@ -1079,7 +1084,14 @@ function macos_messageBox()
{ {
if (this.stderr.str != '' && !this.stderr.str.includes('OpenGL')) if (this.stderr.str != '' && !this.stderr.str.includes('OpenGL'))
{ {
this.that.end(translateObject({ command: 'ERROR', reason: this.stderr.str })); if (this.stderr.str.includes('(-128)'))
{
this.that.end(translateObject({ command: 'DIALOG', button: 'Cancel' }));
}
else
{
this.that.end(translateObject({ command: 'ERROR', reason: this.stderr.str }));
}
} }
else else
{ {