diff --git a/lib/gtk.js b/lib/gtk.js index c07ea6a..463eb2a 100644 --- a/lib/gtk.js +++ b/lib/gtk.js @@ -52,7 +52,7 @@ var GTKCreateWidget = function(widget) { subWidgets[i].left, subWidgets[i].right, subWidgets[i].top, - subWidgets[i].buttom + subWidgets[i].bottom ]); countSubWidgets--; @@ -108,10 +108,14 @@ var GTKExecCommand = function(command) { var line, _command = []; for (var i = 0; i < command.length; i++) { - if (typeof(command[i]) == "number") { - _command.push((command[i] == 0 ? '0' : command[i])); - } else if (typeof(command[i]) == "string") { - _command.push(command[i]); + var term = command[i]; + + if (typeof(term) == "number") { + _command.push(term == 0 ? '0' : command[i]); + } else if (typeof(term) == "boolean") { + _command.push(!term ? '0' : '1'); + } else if (typeof(term) == "string") { + _command.push(term); } } @@ -130,6 +134,13 @@ var GTKInit = function() { ]); }; +// GTKExit +var GTKExit = function() { + return GTKExecCommand([ + "gtk_server_exit" + ]); +}; + // Window var Window = function() { GTKWidget.apply(this, arguments); @@ -156,7 +167,6 @@ var Table = function() { this.rows = 1; this.columns = 1; this.homogeneous = true; - this.attachedWidgets = []; this.attach = function(widget, left, right, top, bottom) { @@ -262,6 +272,8 @@ TextBox.prototype.constructor = TextBox; var GTKWait = function() { var even; + GTKInit(); + while (true) { even = GTKExecCommand([ "gtk_server_callback", @@ -272,6 +284,8 @@ var GTKWait = function() { GTKWidgets[even].onEventTriggered(); } } + + GTKExit(); }; exports.wait = GTKWait;