node-x11/test/query_pointer.js
2012-04-11 16:43:13 +10:00

19 lines
521 B
JavaScript

var x11 = require('../lib/x11');
x11.createClient(function(display) {
var X = display.client;
var screen = display.screen[0];
var wid = X.AllocID();
X.CreateWindow(wid, screen.root, 0, 0, 400, 300);
X.MapWindow(wid);
var interval = setInterval( function() {
X.QueryPointer(wid, function(err, res) {
console.log(res);
});
}, 1000);
X.on('error', function(err) {
console.log(err);
});
X.on('end', function () { clearInterval(interval); });
});