mirror of
https://github.com/danbulant/node-x11
synced 2026-06-14 20:21:40 +00:00
PolyFillRectangle test
This commit is contained in:
parent
e5cfbac8b7
commit
fa75b91599
1 changed files with 34 additions and 0 deletions
34
test/polyfillrect.js
Normal file
34
test/polyfillrect.js
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
var x11 = require('../lib/x11');
|
||||
|
||||
var xclient = x11.createClient();
|
||||
var Exposure = x11.eventMask.Exposure;
|
||||
var PointerMotion = x11.eventMask.PointerMotion;
|
||||
|
||||
xclient.on('connect', function(display) {
|
||||
var X = this;
|
||||
var root = display.screen[0].root;
|
||||
var white = display.screen[0].white_pixel;
|
||||
var black = display.screen[0].black_pixel;
|
||||
|
||||
var wid = X.AllocID();
|
||||
X.CreateWindow(
|
||||
wid, root,
|
||||
10, 10, 400, 300,
|
||||
1, 1, 0,
|
||||
{
|
||||
backgroundPixel: white, eventMask: Exposure|PointerMotion
|
||||
}
|
||||
);
|
||||
X.MapWindow(wid);
|
||||
|
||||
var gc = X.AllocID();
|
||||
X.CreateGC(gc, wid, { foreground: black, background: white } );
|
||||
X.on('event', function(ev) {
|
||||
if (ev.type == 12)
|
||||
{
|
||||
X.PolyFillRectangle(wid, gc, [20, 30, 50, 90]);
|
||||
} else if (ev.type == 6) {
|
||||
console.log(ev.x, ev.y);
|
||||
}
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue