mirror of
https://github.com/danbulant/node-x11
synced 2026-06-09 17:52:36 +00:00
fix sendevent example
This commit is contained in:
parent
9b603d4375
commit
28aa28eccb
1 changed files with 15 additions and 17 deletions
|
|
@ -1,11 +1,11 @@
|
||||||
var x11 = require('../../lib');
|
var x11 = require('../../lib');
|
||||||
|
|
||||||
var xclient = x11.createClient();
|
var xclient = x11.createClient({debug: true});
|
||||||
var Exposure = x11.eventMask.Exposure;
|
var Exposure = x11.eventMask.Exposure;
|
||||||
var PointerMotion = x11.eventMask.PointerMotion;
|
var PointerMotion = x11.eventMask.PointerMotion;
|
||||||
var pts = [];
|
var pts = [];
|
||||||
|
|
||||||
xclient.on('connect', function(err, display) {
|
xclient.on('connect', function(display) {
|
||||||
var X = this;
|
var X = this;
|
||||||
var root = display.screen[0].root;
|
var root = display.screen[0].root;
|
||||||
var white = display.screen[0].white_pixel;
|
var white = display.screen[0].white_pixel;
|
||||||
|
|
@ -13,18 +13,16 @@ xclient.on('connect', function(err, display) {
|
||||||
|
|
||||||
function createWindow()
|
function createWindow()
|
||||||
{
|
{
|
||||||
|
var wid = X.AllocID();
|
||||||
var wid = X.AllocID();
|
// id, parentId, x, y, width, height, borderWidth, depth, _class, visual, values
|
||||||
X.CreateWindow(
|
X.CreateWindow(
|
||||||
wid, root,
|
wid, root,
|
||||||
10, 10, 400, 300,
|
10, 10, 400, 300,
|
||||||
1, 1, 0,
|
0, 0, 0, 0, {
|
||||||
{
|
backgroundPixel: white, eventMask: Exposure|PointerMotion
|
||||||
backgroundPixel: white, eventMask: Exposure|PointerMotion
|
});
|
||||||
}
|
X.MapWindow(wid);
|
||||||
);
|
return wid;
|
||||||
X.MapWindow(wid);
|
|
||||||
return wid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var wid = createWindow();
|
var wid = createWindow();
|
||||||
|
|
@ -59,7 +57,7 @@ xclient.on('connect', function(err, display) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
X.on('error', function(e) {
|
//X.on('error', function(e) {
|
||||||
console.log(e);
|
// console.log(e);
|
||||||
});
|
//});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue