replace timeout with expose

This commit is contained in:
dizzib 2015-03-06 09:34:59 +00:00
parent 45ab095ef2
commit 33f953db32

View file

@ -6,13 +6,10 @@ x11.createClient(function(err, display) {
var w = new Window(X, 0, 0, 700, 500);
w.map();
var render = function() {
//X.ChangeGC(w.gc.id, { foreground: w.black, background: w.white });
w.on('expose', function() {
var gc = X.AllocID();
X.CreateGC(gc, w.id, { foreground: w.black, background: w.white });
X.PolyFillRectangle(w.id, gc, [50, 50, 600, 400]);
X.ClearArea(w.id, 0, 0, 300, 300, 0);
}
setTimeout(render, 100); // sometimes doesn't render without a delay
});
});