mirror of
https://github.com/danbulant/node-x11
synced 2026-05-24 12:35:39 +00:00
replace timeout with expose
This commit is contained in:
parent
45ab095ef2
commit
33f953db32
1 changed files with 2 additions and 5 deletions
|
|
@ -6,13 +6,10 @@ x11.createClient(function(err, display) {
|
||||||
var w = new Window(X, 0, 0, 700, 500);
|
var w = new Window(X, 0, 0, 700, 500);
|
||||||
w.map();
|
w.map();
|
||||||
|
|
||||||
var render = function() {
|
w.on('expose', function() {
|
||||||
//X.ChangeGC(w.gc.id, { foreground: w.black, background: w.white });
|
|
||||||
var gc = X.AllocID();
|
var gc = X.AllocID();
|
||||||
X.CreateGC(gc, w.id, { foreground: w.black, background: w.white });
|
X.CreateGC(gc, w.id, { foreground: w.black, background: w.white });
|
||||||
X.PolyFillRectangle(w.id, gc, [50, 50, 600, 400]);
|
X.PolyFillRectangle(w.id, gc, [50, 50, 600, 400]);
|
||||||
X.ClearArea(w.id, 0, 0, 300, 300, 0);
|
X.ClearArea(w.id, 0, 0, 300, 300, 0);
|
||||||
}
|
});
|
||||||
|
|
||||||
setTimeout(render, 100); // sometimes doesn't render without a delay
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue