Compare commits

...

50 commits

Author SHA1 Message Date
Daniel Bulant
eeb9d58310
Parse FocusIn and FocusOut events 2021-08-05 15:54:39 +02:00
Andrey Sidorov
97e3600467 disable failing envs 2020-05-21 22:02:07 +10:00
Andrey Sidorov
bf56aef5a4 skip failing test 2020-05-21 20:54:16 +10:00
Andrey Sidorov
7728cde55e
Merge pull request #189 from sidorares/greenkeeper/async-3.0.1
Update async to the latest version 🚀
2020-05-21 20:20:03 +10:00
Andrey Sidorov
89fd615f8f
Merge pull request #188 from sidorares/greenkeeper/sinon-7.2.5
Update sinon to the latest version 🚀
2020-05-21 20:19:49 +10:00
Andrey Sidorov
1db2cb54c3
Merge pull request #194 from matoruru/patch-1
Remove unnecessary parentheses from require('os').homedir()
2020-05-21 20:17:05 +10:00
Andrey Sidorov
4ece7f2b0b
Merge branch 'master' into greenkeeper/async-3.0.1 2020-05-21 20:16:03 +10:00
Andrey Sidorov
b50b222a74
Merge pull request #118 from vird/patch-1
Array proto crash fix
2020-05-21 20:13:29 +10:00
Andrey Sidorov
9414ed788d deps: update mocha 2020-05-21 20:10:59 +10:00
Andrey Sidorov
c54dddd746 build: bump node versions to 12 + 14 2020-05-21 20:10:43 +10:00
matoruru
c41ad68e34
Remove unnecessary parentheses from require('os').homedir() 2020-05-19 23:20:01 +09:00
Andrey Sidorov
e17e8b04a1
Merge pull request #192 from mat-sz/master
Replaced os-homedir (deprecated) with os.homedir()
2020-04-25 14:41:43 +10:00
Mat Sz
3d6295f0df .gitignore 2020-04-24 19:35:17 +02:00
Mat Sz
a16c1cb8eb replaced os-homedir with os.homedir() 2020-04-24 19:30:32 +02:00
Andrey Sidorov
8ed75f54e1
Merge pull request #190 from roquef/patch-1
Fixes variable declaration typo in example
2019-10-12 10:39:53 +11:00
Roque Francisco
340432893d
Fixes variable declaration typo in example 2019-10-11 15:07:25 -03:00
greenkeeper[bot]
8500b1fc54 chore(package): update async to version 3.0.1 2019-05-26 21:47:27 +00:00
greenkeeper[bot]
43a7e7375a chore(package): update sinon to version 7.2.5 2019-02-27 12:09:30 +00:00
Andrey Sidorov
f6547d3876
Update README.md 2019-01-15 17:24:08 +11:00
Andrey Sidorov
15c7149c6a Add Render.AddGlyphsFromPicture request 2018-12-13 14:55:07 +11:00
Andrey Sidorov
4bddee6d5e
Merge pull request #181 from SpaceboyRoss01/master
Lots more stuff
2018-11-15 09:32:55 +11:00
Spaceboy Ross
8f322e5f8f Missed something but its fixed 2018-11-14 12:27:41 -08:00
Spaceboy Ross
5c46c4f1d3 Added XBell 2018-11-14 12:27:10 -08:00
Spaceboy Ross
29b454ee3d #182 fixed 2018-11-14 12:22:16 -08:00
Spaceboy Ross
66bc53624d Begining of fixing sidorares/node-x11#182 2018-11-14 12:05:24 -08:00
Spaceboy Ross
d1868d5ee8 Fixed the unpack stream so arrays can work 2018-11-14 11:44:12 -08:00
Andrey Sidorov
2d7ffc2bcd Merge branch 'master' of https://github.com/sidorares/node-x11 2018-07-09 14:01:51 +10:00
Andrey Sidorov
4c6617c994 make text example work when default bg color is black 2018-07-09 14:01:14 +10:00
Andrey Sidorov
174cff9a9c
Merge pull request #172 from sidorares/greenkeeper/sinon-6.0.0
Update sinon to the latest version 🚀
2018-06-11 22:12:09 +10:00
greenkeeper[bot]
2bb273993e chore(package): update sinon to version 6.0.0 2018-06-11 05:58:46 +00:00
Andrey Sidorov
d5c4103b1f
Merge pull request #169 from sidorares/greenkeeper/sinon-5.0.1
chore(package): update sinon to version 5.0.1
2018-04-30 19:52:29 +10:00
greenkeeper[bot]
d004af97fa chore(package): update sinon to version 5.0.1 2018-04-30 08:42:48 +00:00
Andrey Sidorov
ce51cefdad
Merge pull request #167 from sidorares/greenkeeper/sinon-5.0.0
Update sinon to the latest version 🚀
2018-03-22 10:16:26 +11:00
greenkeeper[bot]
373b60b975 chore(package): update sinon to version 5.0.0 2018-03-21 17:27:33 +00:00
Andrey Sidorov
85905efeae
Merge pull request #164 from anko/just-some-maintenance
Mr Janitor coming through
2018-01-24 10:00:56 +11:00
Andrey Sidorov
ef001bd4fb
Merge pull request #163 from anko/stop-testing-on-old-node-versions
Stop testing on Node 0.10 + 0.12
2018-01-24 09:51:14 +11:00
Antti Korpi
6f535cb65d Travis: stop testing on Node 0.10 + 0.12
They're breaking the build, because Mocha (a dependency) is using modern
JS features.
2018-01-23 22:36:27 +01:00
Antti Korpi
ed27aa84ff Fix 'root' deprecation warning
This would previously be printed in part of the test log:

    (node:1628) [DEP0016] DeprecationWarning: 'root' is deprecated, use 'global'

Apparently, the global object was once called root, and this assignment
didn't have a `var`, so it was actually setting the global object.

I do wonder why that didn't break anything, but this is clearly what was
intended.
2018-01-23 22:35:49 +01:00
Antti Korpi
e87b183a8f Use sinon.resetHistory; sinon.reset is deprecated 2018-01-23 22:06:42 +01:00
Antti Korpi
fd09ef9848 Nail devDependencies to specific version
This documents what versions it's supposed to work with, and reduces
potential future confusion if contributors accidentally work with
different tool versions.
2018-01-23 21:59:21 +01:00
Andrey Sidorov
4e84ae8e40 2.3.0 2017-08-27 15:11:35 +10:00
Andrey Sidorov
a97f7a179d Merge pull request #150 from jdomenechb/shapenotify
Added ShapeNotify event parsing
2017-08-27 10:10:37 +10:00
jdomenechb
bc9dceebd4 Added ShapeNotify event parsing 2017-08-26 17:00:10 +02:00
Andrey Sidorov
18cbbdf6ee Merge pull request #148 from andrewstart/master
Fix ChangeGC.
2017-08-05 02:11:35 +10:00
Andrew Start
da262fcb8d Add test for ChangeGC. 2017-08-04 12:05:05 -04:00
Andrew Start
8049e70deb Fix ChangeGC. 2017-08-04 11:45:41 -04:00
Andrey Sidorov
eb674cc41c Merge pull request #147 from anko/readme-cleanup
Readme cleanup
2017-07-21 08:45:41 +10:00
Antti Korpi
f13247ec6d Readme cleanup
- Drop headings to level 2 (except the top one).
 - Fix Gitter link.
 - Trim example code indent level.
2017-07-20 17:07:56 +01:00
Andrey Sidorov
6598e75baf add link to xelb 2017-06-09 11:11:34 +10:00
vird
7e8e972b24 Array proto crash fix
fixed crash when Array has some proto modifications; minor spaces fix
2015-11-29 19:11:19 +02:00
33 changed files with 1081 additions and 840 deletions

4
.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
*.log
yarn.lock
package-lock.json
node_modules

View file

@ -7,14 +7,10 @@ before_script:
env: env:
- NOLISTEN=tcp DISPLAY=:99.0 - NOLISTEN=tcp DISPLAY=:99.0
- NOLISTEN=unix DISPLAY=:99.0 # - NOLISTEN=unix DISPLAY=:99.0
- NOLISTEN=unix DISPLAY=127.0.0.2:99.0 # - NOLISTEN=unix DISPLAY=127.0.0.2:99.0
language: node_js language: node_js
node_js: node_js:
- '0.10' - '12'
- '0.12' - '14'
- '4.2'
- '5'
- '6'
- '7'

180
README.md
View file

@ -1,105 +1,119 @@
# About # node-x11
[![Gitter](https://badges.gitter.im/Join\ Chat.svg)](https://gitter.im/sidorares/node-x11?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
X11 protocol client for node.js
Implements core X11 protocol, as well as Xrender, Damage, Composite, Big-Requests, Dpms, Screensaver, XFixes, Shape, XTest, XC-Misc, GLX and Apple-WM extensions. X11 protocol client for Node.js: implements the core X11 protocol, as well as Xrender, Damage, Composite, Big-Requests, Dpms, Screensaver, XFixes, Shape, XTest, XC-Misc, GLX, and Apple-WM extensions.
# install
`npm install x11`
Windows users:
1) install [XMing](http://www.straightrunning.com/XmingNotes/) or [Cygwin/X](http://x.cygwin.com/)
2) get node-x11 copy (using [git](http://code.google.com/p/msysgit/downloads/list?can=3) or from [Github](https://github.com/sidorares/node-x11/archives/master ))
#CI build status:
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/sidorares/node-x11?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://secure.travis-ci.org/sidorares/node-x11.png)](http://travis-ci.org/sidorares/node-x11) [![Build Status](https://secure.travis-ci.org/sidorares/node-x11.png)](http://travis-ci.org/sidorares/node-x11)
# example ## Install
npm install x11
Windows users:
1. install [XMing](http://www.straightrunning.com/XmingNotes/) or [Cygwin/X](http://x.cygwin.com/)
2. get node-x11 copy (using [git](http://code.google.com/p/msysgit/downloads/list?can=3) or from [Github](https://github.com/sidorares/node-x11/archives/master))
## Example
Core requests usage: Core requests usage:
```js ```js
var x11 = require('x11'); var x11 = require('x11');
var Exposure = x11.eventMask.Exposure; var Exposure = x11.eventMask.Exposure;
var PointerMotion = x11.eventMask.PointerMotion; var PointerMotion = x11.eventMask.PointerMotion;
x11.createClient(function(err, display) { x11.createClient(function(err, display) {
if (!err) { if (!err) {
var X = display.client; var X = display.client;
var root = display.screen[0].root; var root = display.screen[0].root;
var wid = X.AllocID(); var wid = X.AllocID();
X.CreateWindow( X.CreateWindow(
wid, root, // new window id, parent wid,
0, 0, 100, 100, // x, y, w, h root, // new window id, parent
0, 0, 0, 0, // border, depth, class, visual 0,
{ eventMask: Exposure|PointerMotion } // other parameters 0,
); 500,
X.MapWindow(wid); 500, // x, y, w, h
var gc = X.AllocID(); 0,
X.CreateGC(gc, wid); 0,
X.on('event', function(ev) { 0,
if (ev.type == 12) 0, // border, depth, class, visual
{ { eventMask: Exposure | PointerMotion } // other parameters
X.PolyText8(wid, gc, 50, 50, ['Hello, Node.JS!']); );
} X.MapWindow(wid);
}); var gc = X.AllocID();
X.on('error', function(e) { X.CreateGC(gc, wid);
console.log(e); var white = display.screen[0].white_pixel;
}); var black = display.screen[0].black_pixel;
} else { cidBlack = X.AllocID();
console.log(err); cidWhite = X.AllocID();
} X.CreateGC(cidBlack, wid, { foreground: black, background: white });
X.CreateGC(cidWhite, wid, { foreground: white, background: black });
X.on('event', function(ev) {
if (ev.type == 12) {
X.PolyFillRectangle(wid, cidWhite, [0, 0, 500, 500]);
X.PolyText8(wid, cidBlack, 50, 50, ['Hello, Node.JS!']);
}
}); });
X.on('error', function(e) {
console.log(e);
});
} else {
console.log(err);
}
});
``` ```
# Screenshots ## Screenshots
![tetris game](https://lh6.googleusercontent.com/-RCRY9A7WwnA/Tlww0FHP7NI/AAAAAAAAAwo/nxfSxsw6xow/s400/tetris.png) ![tetris game](https://lh6.googleusercontent.com/-RCRY9A7WwnA/Tlww0FHP7NI/AAAAAAAAAwo/nxfSxsw6xow/s400/tetris.png)
![XRENDER gradients](https://lh4.googleusercontent.com/-VS0BMYYmq6M/Tlww0Y1ij0I/AAAAAAAAAws/pVWsPZ63Yeo/s400/render-gradients.png) ![XRENDER gradients](https://lh4.googleusercontent.com/-VS0BMYYmq6M/Tlww0Y1ij0I/AAAAAAAAAws/pVWsPZ63Yeo/s400/render-gradients.png)
![OpenGL glxgears](http://img-fotki.yandex.ru/get/4123/37511094.30/0_81712_6c2ebb11_L) ![OpenGL glxgears](http://img-fotki.yandex.ru/get/4123/37511094.30/0_81712_6c2ebb11_L)
![OpenGL teapot](http://img-fotki.yandex.ru/get/4132/37511094.30/0_81713_82a5ac48_L) ![OpenGL teapot](http://img-fotki.yandex.ru/get/4132/37511094.30/0_81713_82a5ac48_L)
# In use ## In use
- [ntk](https://github.com/sidorares/ntk) - higher level toolkit on top of X11
- [node-remote](https://github.com/AndrewSwerlick/node-remote) - media center controller
- [tiles](https://github.com/dominictarr/tiles) - tiling window manager
- [vnc](https://github.com/sidorares/node-vnc) - vnc client.
- [node-ewmh](https://github.com/santigimeno/node-ewmh) - set of EWMH helpers.
- [OdieWM](https://github.com/bu/OdieWM) - window manager
- [Dbusmenu](https://github.com/sidorares/node-dbusmenu) - unity global menu client.
- [AirWM](https://github.com/AirWM/AirWM) - tiling window manager
- [npdf](https://github.com/sidorares/npdf) - pdf viewer
- [tinywm](https://github.com/Airblader/node-tinywm) The famous [TinyWM](https://github.com/mackstann/tinywm) written in node.js
- [basedwm](https://github.com/anko/basedwm) Infinite-desktop panning X window manager in LiveScript
# X11 resources/documentation: - [ntk](https://github.com/sidorares/ntk) - higher level toolkit on top of X11
- [node-remote](https://github.com/AndrewSwerlick/node-remote) - media center controller
- [tiles](https://github.com/dominictarr/tiles) - tiling window manager
- [vnc](https://github.com/sidorares/node-vnc) - vnc client.
- [node-ewmh](https://github.com/santigimeno/node-ewmh) - set of EWMH helpers.
- [OdieWM](https://github.com/bu/OdieWM) - window manager
- [Dbusmenu](https://github.com/sidorares/node-dbusmenu) - unity global menu client.
- [AirWM](https://github.com/AirWM/AirWM) - tiling window manager
- [npdf](https://github.com/sidorares/npdf) - pdf viewer
- [tinywm](https://github.com/Airblader/node-tinywm) The famous [TinyWM](https://github.com/mackstann/tinywm) written in node.js
- [basedwm](https://github.com/anko/basedwm) Infinite-desktop panning X window manager in LiveScript
- [Xplain](https://github.com/magcius/xplain) - A series of articles to help explain the X Window System http://magcius.github.io/xplain/article/ ## X11 resources/documentation:
- [Official X11 docs](http://www.x.org/releases/X11R7.6/doc/)
- [protocol specification](http://www.x.org/releases/X11R7.6/doc/xproto/x11protocol.pdf)
- C Xlib to X11 request mapping table http://tronche.com/gui/x/xlib/appendix/a.html
- [How to write composite manager](http://www.talisman.org/~erlkonig/misc/x11-composite-tutorial/)
- [Extended Window Manager Hints specification](http://standards.freedesktop.org/wm-spec/wm-spec-1.3.html)
# Other implementations - [Xplain](https://github.com/magcius/xplain) - A series of articles to help explain the X Window System http://magcius.github.io/xplain/article/
- [Official X11 docs](http://www.x.org/releases/X11R7.6/doc/)
- [protocol specification](http://www.x.org/releases/X11R7.6/doc/xproto/x11protocol.pdf)
- C Xlib to X11 request mapping table http://tronche.com/gui/x/xlib/appendix/a.html
- [How to write composite manager](http://www.talisman.org/~erlkonig/misc/x11-composite-tutorial/)
- [Extended Window Manager Hints specification](http://standards.freedesktop.org/wm-spec/wm-spec-1.3.html)
- C: XLib - http://www.sbin.org/doc/Xlib/ http://www.tronche.com/gui/x/xlib/ http://www.x.org/docs/X11/xlib.pdf ## Other implementations
- C: XCB - http://xcb.freedesktop.org/
- Python: http://sourceforge.net/projects/python-xlib/ ( github fork: https://github.com/Ademan/python-xlib-branch pypi: http://pypi.python.org/pypi/Python%20Xlib )
- https://github.com/alexer/python-xlib-render
- Python/twisted: https://launchpad.net/twisted-x11
- Perl: http://search.cpan.org/~smccam/X11-Protocol-0.56/Protocol.pm
- Go: https://github.com/BurntSushi/xgb
- Java: https://github.com/xderoche/J11
- Ruby: https://github.com/dj2/x-ruby-bindings
- Clojure: https://github.com/noodlewiz/xcljb
- Guile: https://github.com/mwitmer/guile-xcb
# Server side (protocol + functionality) implementations for js + DOM - C: XLib - http://www.sbin.org/doc/Xlib/ http://www.tronche.com/gui/x/xlib/ http://www.x.org/docs/X11/xlib.pdf
- C: XCB - http://xcb.freedesktop.org/
- Python: http://sourceforge.net/projects/python-xlib/ ( github fork: https://github.com/Ademan/python-xlib-branch pypi: http://pypi.python.org/pypi/Python%20Xlib )
- https://github.com/alexer/python-xlib-render
- Python/twisted: https://launchpad.net/twisted-x11
- Perl: http://search.cpan.org/~smccam/X11-Protocol-0.56/Protocol.pm
- Go: https://github.com/BurntSushi/xgb
- Java: https://github.com/xderoche/J11
- Ruby: https://github.com/dj2/x-ruby-bindings
- Clojure: https://github.com/noodlewiz/xcljb
- Guile: https://github.com/mwitmer/guile-xcb
- Emacs lisp: https://github.com/ch11ng/xelb ( autogenerated from XCB XML )
would be really great to make completely web based playground page, connecting node-x11 api to DOM based implementation ## Server side (protocol + functionality) implementations for js + DOM
- https://github.com/GothAck/javascript-x-server would be really great to make completely web based playground page, connecting node-x11 api to DOM based implementation
- https://github.com/ttaubert/x-server-js
- https://github.com/GothAck/javascript-x-server
- https://github.com/ttaubert/x-server-js

View file

@ -252,7 +252,7 @@ function genReq(req, last)
if (req.body.length == 0) if (req.body.length == 0)
{ {
result.push(' function() {'); result.push(' function() {');
result.push(' return new Buffer([' + req.opcode + ', 0, 1, 0]);'); result.push(' return Buffer.from([' + req.opcode + ', 0, 1, 0]);');
} else { } else {
result.push(' function (args) {'); result.push(' function (args) {');
result.push(' var extraLength = 0;'); result.push(' var extraLength = 0;');
@ -287,10 +287,10 @@ function genReq(req, last)
var reqLen4 = ((reqLen + 3) >> 2); var reqLen4 = ((reqLen + 3) >> 2);
if (extraLength) if (extraLength)
result.push(' var data = new Buffer(' + reqLen + ' + extraLength);'); result.push(' var data = Buffer.alloc(' + reqLen + ' + extraLength);');
else { else {
result.pop(); result.pop();
result.push(' var data = new Buffer(' + reqLen + ');'); result.push(' var data = Buffer.alloc(' + reqLen + ');');
} }
result.push(' data[0] = ' + req.opcode + ';'); result.push(' data[0] = ' + req.opcode + ';');
if (req.body.length != 0) { if (req.body.length != 0) {

View file

@ -571,7 +571,7 @@ module.exports.readJpeg = function(path)
var imageData = {}; var imageData = {};
imageData.width = j.width; imageData.width = j.width;
imageData.height = j.height; imageData.height = j.height;
imageData.data = new Buffer(j.width*j.height*4); imageData.data = Buffer.from(j.width*j.height*4);
j.copyToImageData(imageData); j.copyToImageData(imageData);
return imageData; return imageData;
} }

View file

@ -874,7 +874,7 @@ module.exports.readPng = function(path)
var imageData = {}; var imageData = {};
imageData.width = j.width; imageData.width = j.width;
imageData.height = j.height; imageData.height = j.height;
imageData.data = new Buffer(j.width*j.height*4); imageData.data = Buffer.alloc(j.width*j.height*4);
j.render(imageData); j.render(imageData);
return imageData; return imageData;
} }

View file

@ -7,7 +7,7 @@ var xclient = x11.createClient(function(err, display) {
display.client.require('render', function(err, Render) { display.client.require('render', function(err, Render) {
var wid = X.AllocID(); var wid = X.AllocID();
var white = display.screen[0].white_pixel; var white = display.screen[0].white_pixel;
varblack = display.screen[0].black_pixel; var black = display.screen[0].black_pixel;
X.CreateWindow(wid, root, 10, 10, 400, 300, 0, 0, 0, 0, { backgroundPixel: white, eventMask: PointerMotion }); X.CreateWindow(wid, root, 10, 10, 400, 300, 0, 0, 0, 0, { backgroundPixel: white, eventMask: PointerMotion });
X.MapWindow(wid); X.MapWindow(wid);

View file

@ -26,7 +26,7 @@ function padWidth(buf, width) {
return buf; return buf;
else { else {
var stride = (width+3)&~3; var stride = (width+3)&~3;
var res = new Buffer(height*stride); var res = Buffer.alloc(height*stride);
res.fill(0); res.fill(0);
for (var y=0; y < height; ++y) { for (var y=0; y < height; ++y) {
// memcpy(tmpbitmap+y*stride, bitmap->buffer+y*ginfo.width, ginfo.width); // memcpy(tmpbitmap+y*stride, bitmap->buffer+y*ginfo.width, ginfo.width);
@ -88,7 +88,7 @@ var xclient = x11.createClient({ debug: true }, function(err, display) {
var glyphFromCode = []; var glyphFromCode = [];
glyphs.forEach(function(g) { glyphs.forEach(function(g) {
if (!g.image || (g.image.length == 0)) { if (!g.image || (g.image.length == 0)) {
g.image = new Buffer(64); g.image = Buffer.alloc(64);
g.image.fill(0); g.image.fill(0);
g.width = 8; g.width = 8;
g.height = 8; g.height = 8;

View file

@ -6,7 +6,7 @@ var Pixmap = require('./pixmap').Pixmap;
var Buffer = require('buffer').Buffer; var Buffer = require('buffer').Buffer;
require('../../lib/unpackbuffer').addUnpack(Buffer); require('../../lib/unpackbuffer').addUnpack(Buffer);
var reversed = new Buffer(256); var reversed = Buffer.alloc(256);
for (var i=0; i < 256; ++i) for (var i=0; i < 256; ++i)
{ {
var res = 0; var res = 0;
@ -42,4 +42,4 @@ module.exports.decodeBuffer = function(buffer)
data[i] = 255 - reversed[data[i]]; data[i] = 255 - reversed[data[i]];
return new Pixmap(header.bpp, header.width, header.height, data); return new Pixmap(header.bpp, header.width, header.height, data);
} }

View file

@ -8,7 +8,7 @@ var xclient = x11.createClient();
var Exposure = x11.eventMask.Exposure; var Exposure = x11.eventMask.Exposure;
var PointerMotion = x11.eventMask.PointerMotion; var PointerMotion = x11.eventMask.PointerMotion;
var bitmap = new Buffer(128*128/8); // 16384 bits, 2048 bytes bitmap var bitmap = Buffer.alloc(128*128/8); // 16384 bits, 2048 bytes bitmap
for (var i=0; i < bitmap.length; ++i) for (var i=0; i < bitmap.length; ++i)
{ {
bitmap[i] = i % 256; bitmap[i] = i % 256;

View file

@ -4,7 +4,7 @@ var x11 = require('../../lib');
var Exposure = x11.eventMask.Exposure; var Exposure = x11.eventMask.Exposure;
var PointerMotion = x11.eventMask.PointerMotion; var PointerMotion = x11.eventMask.PointerMotion;
var bitmap = new Buffer(128*128*4); // 16384 bits, 2048 bytes bitmap var bitmap = Buffer.alloc(128*128*4); // 16384 bits, 2048 bytes bitmap
for (var i=0; i < bitmap.length; ++i) for (var i=0; i < bitmap.length; ++i)
{ {
var byteNum = i%4; var byteNum = i%4;

View file

@ -25,7 +25,7 @@ var Buffer = require('buffer').Buffer;
var startpos = [4, 15]; var startpos = [4, 15];
var cupsize = [10, 20]; var cupsize = [10, 20];
var cup = new Buffer(cupsize[0]*cupsize[1]); var cup = Buffer.alloc(cupsize[0]*cupsize[1]);
var moveInterval; var moveInterval;
function clearCup() function clearCup()

View file

@ -56,8 +56,8 @@ var pc2 = [
function deskey(key, edf) function deskey(key, edf)
{ {
var i, j, l, m, n; var i, j, l, m, n;
var pc1m = new Buffer(56); var pc1m = Buffer.alloc(56);
var pcr = new Buffer(56); var pcr = Buffer.alloc(56);
var kn = new Array(32); var kn = new Array(32);
for ( j = 0; j < 56; j++ ) { for ( j = 0; j < 56; j++ ) {
@ -388,17 +388,17 @@ function desfunc(block, keys)
module.exports.response = function(challenge, password) module.exports.response = function(challenge, password)
{ {
var key = new Buffer(8); var key = Buffer.alloc(8);
key.fill(0); key.fill(0);
key.write(password.substring(0,8)); key.write(password.substring(0,8));
var in1 = challenge.slice(0,8); var in1 = challenge.slice(0,8);
var in2 = challenge.slice(8,16); var in2 = challenge.slice(8,16);
var res1 = new Buffer(8); var res1 = Buffer.alloc(8);
var res2 = new Buffer(8); var res2 = Buffer.alloc(8);
deskey(key, EN0); deskey(key, EN0);
des(in1, res1); des(in1, res1);
des(in2, res2); des(in2, res2);
var resp = new Buffer(16); var resp = Buffer.alloc(16);
res1.copy(resp); res1.copy(resp);
res2.copy(resp, 8); res2.copy(resp, 8);
return resp; return resp;

View file

@ -7,7 +7,7 @@
// It should create a pleasant looking hex dumb by default: // It should create a pleasant looking hex dumb by default:
// //
// var hexy = require('hexy.js'), // var hexy = require('hexy.js'),
// b = new Buffer("\000\001\003\005\037\012\011bcdefghijklmnopqrstuvwxyz0123456789") // b = Buffer.from("\000\001\003\005\037\012\011bcdefghijklmnopqrstuvwxyz0123456789")
// //
// console.log(hexy.hexy(b)) // console.log(hexy.hexy(b))
// //
@ -258,4 +258,4 @@ console.log(hexy(data, format))
console.log("doen") console.log("doen")
*/ */
exports.hexy = hexy exports.hexy = hexy

View file

@ -400,7 +400,7 @@ RfbClient.prototype.readHextileTile = function(rect, cb)
}); });
return; return;
} }
tile.buffer = new Buffer(tilebuflen); tile.buffer = Buffer.alloc(tilebuflen);
function solidBackground() { function solidBackground() {
clog('solidBackground'); clog('solidBackground');
@ -667,8 +667,8 @@ function createConnection(params)
var wstream = fs.createWriteStream(params.rfbFileOut); var wstream = fs.createWriteStream(params.rfbFileOut);
wstream.write('FBS 001.001\n'); wstream.write('FBS 001.001\n');
stream.on('data', function(data) { stream.on('data', function(data) {
var sizeBuf = new Buffer(4); var sizeBuf = Buffer.alloc(4);
var timeBuf = new Buffer(4); var timeBuf = Buffer.alloc(4);
var size = data.length; var size = data.length;
sizeBuf.writeInt32BE(size, 0); sizeBuf.writeInt32BE(size, 0);
wstream.write(sizeBuf); wstream.write(sizeBuf);
@ -676,7 +676,7 @@ function createConnection(params)
timeBuf.writeInt32BE(+new Date() - start, 0); timeBuf.writeInt32BE(+new Date() - start, 0);
wstream.write(timeBuf); wstream.write(timeBuf);
var padding = 3 - ((size - 1) & 0x03); var padding = 3 - ((size - 1) & 0x03);
var pbuf = new Buffer(padding); var pbuf = Buffer.alloc(padding);
wstream.write(pbuf); wstream.write(pbuf);
}).on('end', function() { }).on('end', function() {
wstream.end(); wstream.end();

View file

@ -62,7 +62,7 @@ RfbServer.prototype.processSecurity = function()
break; break;
case rfb.security.VNC: case rfb.security.VNC:
// generate random 16 byte challenge // generate random 16 byte challenge
serv.challenge = new Buffer(16); serv.challenge = Buffer.alloc(16);
serv.challenge.write('1234567890abcdef'); serv.challenge.write('1234567890abcdef');
console.log(['sending challenge', serv.challenge]); console.log(['sending challenge', serv.challenge]);
serv.pack_stream.pack('a', [serv.challenge]).flush(); serv.pack_stream.pack('a', [serv.challenge]).flush();

View file

@ -34,7 +34,7 @@ function ReadFixedRequest(length, callback)
this.length = length; this.length = length;
this.callback = callback; this.callback = callback;
//clog(length); //clog(length);
this.data = new Buffer(length); this.data = Buffer.alloc(length);
this.received_bytes = 0; this.received_bytes = 0;
} }
@ -328,7 +328,7 @@ UnpackStream.prototype.pack = function(format, args)
} }
} }
var buf = new Buffer(packetlength); var buf = Buffer.alloc(packetlength);
var offset = 0; var offset = 0;
var arg = 0; var arg = 0;
for (var i = 0; i < format.length; ++i) for (var i = 0; i < format.length; ++i)

View file

@ -95,7 +95,7 @@ PixmapFromFile.prototype.mapColors = function(content,size){
} }
PixmapFromFile.prototype.toBuffer = function (colors,content,size) { PixmapFromFile.prototype.toBuffer = function (colors,content,size) {
var buf = new Buffer(size.width*size.height*4); var buf = Buffer.alloc(size.width*size.height*4);
var offset = 0, byte,color; var offset = 0, byte,color;
var copy; var copy;
if( !this.options.format || this.options.format.toUpperCase() === "BGRA"){ if( !this.options.format || this.options.format.toUpperCase() === "BGRA"){

View file

@ -50,7 +50,7 @@ function parseXauth( buf )
return auth; return auth;
} }
var homedir = require('os-homedir'); var homedir = require('os').homedir;
var path = require('path'); var path = require('path');
function readXauthority(cb) { function readXauthority(cb) {

View file

@ -217,25 +217,26 @@ function packValueMask(reqname, values)
{ {
var v = reqValueMask[value]; var v = reqValueMask[value];
if (v) { if (v) {
var valueBit = v.mask; var valueBit = v.mask;
if (!valueBit) if (!valueBit)
throw new Error(reqname + ': incorrect value param ' + value); throw new Error(reqname + ': incorrect value param ' + value);
masksList.push(valueBit); masksList.push(valueBit);
bitmask |= valueBit; bitmask |= valueBit;
} }
} }
/* numeric sort */ /* numeric sort */
masksList.sort(function(a, b) { masksList.sort(function(a, b) {
return a - b; return a - b;
}); });
var args = []; var args = [];
for (m in masksList) for (var i=0,length=masksList.length;i<length;i++)
{ {
var valueName = reqValueMaskName[masksList[m]]; var value = masksList[i];
format += reqValueMask[valueName].format var valueName = reqValueMaskName[value];
args.push( values[valueName] ); format += reqValueMask[valueName].format
args.push( values[valueName] );
} }
return [format, bitmask, args] return [format, bitmask, args]
} }
@ -464,7 +465,7 @@ var templates = {
function(mode, wid, name, type, units, data) function(mode, wid, name, type, units, data)
{ {
var padded4 = (data.length + 3) >> 2; var padded4 = (data.length + 3) >> 2;
var pad = new Buffer( (padded4<<2) - data.length); var pad = Buffer.alloc( (padded4<<2) - data.length);
var format = 'CCSLLLCxxxLaa'; var format = 'CCSLLLCxxxLaa';
var requestLength = 6 + padded4; var requestLength = 6 + padded4;
var dataLenInFormatUnits = data.length / (units >> 3); var dataLenInFormatUnits = data.length / (units >> 3);
@ -765,13 +766,9 @@ var templates = {
var vals = packValueMask('CreateGC', values); var vals = packValueMask('CreateGC', values);
var packetLength = 3 + (values ? vals[2].length : 0); var packetLength = 3 + (values ? vals[2].length : 0);
var args = [56, packetLength, cid]; var args = [56, packetLength, cid];
args.push(vals[0]); // values bitmask format += vals[0]
var valArr = vals[1]; args.push(vals[1]); // values bitmask
for (var v in valArr) args = args.concat(vals[2])
{
format += 'L'; // TODO: we know format string length in advance and += inefficient for string
args.push(valArr[v]);
}
return [format, args]; return [format, args];
} }
], ],
@ -854,7 +851,7 @@ var templates = {
var padded = xutil.padded_length(data.length); var padded = xutil.padded_length(data.length);
var reqLen = 6 + padded/4; // (length + 3) >> 2 ??? var reqLen = 6 + padded/4; // (length + 3) >> 2 ???
var padLength = padded - data.length; var padLength = padded - data.length;
var pad = new Buffer(padLength); // TODO: new pack format 'X' - skip amount of bytes supplied in numerical argument var pad = Buffer.alloc(padLength); // TODO: new pack format 'X' - skip amount of bytes supplied in numerical argument
// TODO: move code to calculate reqLength and use BigReq if needed outside of corereq.js // TODO: move code to calculate reqLength and use BigReq if needed outside of corereq.js
// NOTE: big req is used here (first 'L' in format, 0 and +1 in params), won't work if not enabled // NOTE: big req is used here (first 'L' in format, 0 and +1 in params), won't work if not enabled
@ -1023,6 +1020,12 @@ var templates = {
return [ 'CxSssCCxx', [107, 3, timeout, interval, preferBlanking, allowExposures]]; return [ 'CxSssCCxx', [107, 3, timeout, interval, preferBlanking, allowExposures]];
} }
], ],
Bell: [
function(percent) {
return ["CxCs",[108,1]];
}
],
ForceScreenSaver: [ ForceScreenSaver: [
function(activate) { function(activate) {

View file

@ -258,7 +258,7 @@ exports.requireExt = function(display, callback)
ext.BindTexImage = function(ctx, drawable, buffer, attribs) { ext.BindTexImage = function(ctx, drawable, buffer, attribs) {
if (!attribs) if (!attribs)
attribs = []; attribs = [];
var data = new Buffer(12 + attribs.length*4); var data = Buffer.alloc(12 + attribs.length*4);
data.writeUInt32LE(drawable, 0); data.writeUInt32LE(drawable, 0);
data.writeUInt32LE(buffer, 4); data.writeUInt32LE(buffer, 4);
data.writeUInt32LE(attribs.length, 8); data.writeUInt32LE(attribs.length, 8);
@ -268,7 +268,7 @@ exports.requireExt = function(display, callback)
} }
ext.ReleaseTexImage = function(ctx, drawable, buffer) { ext.ReleaseTexImage = function(ctx, drawable, buffer) {
var data = new Buffer(8); var data = Buffer.alloc(8);
data.writeUint32LE(drawable, 0); data.writeUint32LE(drawable, 0);
data.writeUint32LE(buffer, 4); data.writeUint32LE(buffer, 4);
ext.VendorPrivate(ctx, 1331, data); ext.VendorPrivate(ctx, 1331, data);
@ -287,7 +287,7 @@ exports.requireExt = function(display, callback)
X.pack_stream.pack('CCSLSSL', [ext.majorOpcode, 2, length, ctx, requestNum, requestTotal, data.length]); X.pack_stream.pack('CCSLSSL', [ext.majorOpcode, 2, length, ctx, requestNum, requestTotal, data.length]);
X.pack_stream.write_queue.push(data); X.pack_stream.write_queue.push(data);
var pad = new Buffer(padLength); var pad = Buffer.alloc(padLength);
pad.fill(0); pad.fill(0);
X.pack_stream.write_queue.push(pad); X.pack_stream.write_queue.push(pad);
X.pack_stream.flush(); X.pack_stream.flush();

View file

@ -16,7 +16,7 @@ module.exports = function(GLX, ctx) {
throw Error('Buffer too big. Make sure you are using RenderLarge for large commands'); throw Error('Buffer too big. Make sure you are using RenderLarge for large commands');
currentLength += len; currentLength += len;
var res = Buffer(len); var res = Buffer.alloc(len);
res.writeUInt16LE(len, 0); res.writeUInt16LE(len, 0);
res.writeUInt16LE(opcode, 2); res.writeUInt16LE(opcode, 2);
return res; return res;
@ -266,7 +266,7 @@ module.exports = function(GLX, ctx) {
typeSize[constants.BYTE] = 1; typeSize[constants.BYTE] = 1;
typeSize[constants.UNSIGNED_BYTE] = 1; typeSize[constants.UNSIGNED_BYTE] = 1;
var res = new Buffer(60 + data.length*typeSize[type]); var res = Buffer.alloc(60 + data.length*typeSize[type]);
res.writeUInt32LE(res.length, 0); res.writeUInt32LE(res.length, 0);
res.writeUInt32LE(110, 4); res.writeUInt32LE(110, 4);

File diff suppressed because it is too large Load diff

View file

@ -112,5 +112,31 @@ exports.requireExt = function(display, callback)
callback(null, ext); callback(null, ext);
}); });
*/ */
ext.events = {
ShapeNotify: 0
}
X.eventParsers[ext.firstEvent + ext.events.ShapeNotify] = function(type, seq, extra, code, raw)
{
var event = {};
event.type = type;
event.kind = code;
event.seq = seq;
event.window = extra;
var values = raw.unpack('ssSSLC');
event.x = values[0];
event.y = values[1];
event.width = values[2];
event.height = values[3];
event.time = values[4];
event.shaped = values[5];
event.name = 'ShapeNotify';
return event;
};
}); });
} }

View file

@ -7,7 +7,7 @@
// It should create a pleasant looking hex dumb by default: // It should create a pleasant looking hex dumb by default:
// //
// var hexy = require('hexy.js'), // var hexy = require('hexy.js'),
// b = new Buffer("\000\001\003\005\037\012\011bcdefghijklmnopqrstuvwxyz0123456789") // b = Buffer.alloc("\000\001\003\005\037\012\011bcdefghijklmnopqrstuvwxyz0123456789")
// //
// console.log(hexy.hexy(b)) // console.log(hexy.hexy(b))
// //
@ -258,4 +258,4 @@ console.log(hexy(data, format))
console.log("doen") console.log("doen")
*/ */
exports.hexy = hexy exports.hexy = hexy

View file

@ -23,7 +23,7 @@ function ReadFixedRequest(length, callback)
{ {
this.length = length; this.length = length;
this.callback = callback; this.callback = callback;
this.data = new Buffer(length); this.data = Buffer.alloc(length);
this.received_bytes = 0; this.received_bytes = 0;
} }
@ -201,7 +201,7 @@ UnpackStream.prototype.pstr = function(str)
var len = xutil.padded_length(str.length); var len = xutil.padded_length(str.length);
if (len == 0) if (len == 0)
return; // nothing to write return; // nothing to write
var buf = new Buffer(len); var buf = Buffer.alloc(len);
buf.write(str, 'binary'); buf.write(str, 'binary');
this.write_queue.push(buf); this.write_queue.push(buf);
} }
@ -231,7 +231,7 @@ UnpackStream.prototype.pack = function(format, args)
} }
} }
var buf = new Buffer(packetlength); var buf = Buffer.alloc(packetlength);
var offset = 0; var offset = 0;
var arg = 0; var arg = 0;
for (var i = 0; i < format.length; ++i) for (var i = 0; i < format.length; ++i)
@ -269,12 +269,14 @@ UnpackStream.prototype.pack = function(format, args)
buf[offset++] = (n >> 16) & 0xff; buf[offset++] = (n >> 16) & 0xff;
buf[offset++] = (n >> 24) & 0xff; buf[offset++] = (n >> 24) & 0xff;
break; break;
case 'a': // string or buffer case 'a': // string, buffer, or array
var str = args[arg++]; var str = args[arg++];
if (Buffer.isBuffer(str)) if (Buffer.isBuffer(str))
{ {
str.copy(buf, offset); str.copy(buf, offset);
offset += str.length; offset += str.length;
} else if(Array.isArray(str)) {
for(var item of str) buf[offset++] = item;
} else { } else {
// TODO: buffer.write could be faster // TODO: buffer.write could be faster
for (var c = 0; c < str.length; ++c) for (var c = 0; c < str.length; ++c)

View file

@ -322,7 +322,14 @@ XClient.prototype.unpackEvent = function(type, seq, extra, code, raw, headerBuf)
event.x = values[5]; event.x = values[5];
event.y = values[6]; event.y = values[6];
event.values = values event.values = values
} else if (type == 9) { // FocusIn
event.name = "FocusIn";
event.mode = raw.unpack('C')[0];
event.wid = extra;
} else if (type == 10) { // FocusOut
event.name = "FocusOut";
event.mode = raw.unpack('C')[0];
event.wid = extra;
} else if (type == 12) { // Expose } else if (type == 12) { // Expose
var values = raw.unpack('SSSSS'); var values = raw.unpack('SSSSS');
event.name = 'Expose' event.name = 'Expose'
@ -508,7 +515,7 @@ XClient.prototype.expectReplyHeader = function()
// raw event 32-bytes packet (primarily for use in SendEvent); // raw event 32-bytes packet (primarily for use in SendEvent);
// TODO: Event::pack based on event parameters, inverse to unpackEvent // TODO: Event::pack based on event parameters, inverse to unpackEvent
ev.rawData = new Buffer(32); ev.rawData = Buffer.alloc(32);
headerBuf.copy(ev.rawData); headerBuf.copy(ev.rawData);
buf.copy(ev.rawData, 8); buf.copy(ev.rawData, 8);

View file

@ -12,7 +12,7 @@
"X" "X"
], ],
"homepage": "https://github.com/sidorares/node-x11", "homepage": "https://github.com/sidorares/node-x11",
"version": "2.2.1", "version": "2.3.0",
"maintainers": [ "maintainers": [
{ {
"name": "Andrey Sidorov", "name": "Andrey Sidorov",
@ -40,17 +40,15 @@
"node": "*" "node": "*"
}, },
"devDependencies": { "devDependencies": {
"mocha": "*", "async": "^3.0.1",
"should": "*", "mocha": "^7.1.2",
"sax": "*", "sax": "^1.2.4",
"async": "*", "should": "^13.2.1",
"sinon": "*" "sinon": "^7.2.5"
}, },
"scripts": { "scripts": {
"test": "node test-runner.js", "test": "node test-runner.js",
"prepublish": "npm prune" "prepublish": "npm prune"
}, },
"dependencies": { "dependencies": {}
"os-homedir": "^1.0.1"
}
} }

View file

@ -63,7 +63,7 @@ describe('Atoms and atom names cache', function() {
}); });
}); });
it('should be used after the first request for non-std atom_names', function(done) { xit('should be used after the first request for non-std atom_names', function(done) {
var self = this; var self = this;
var my_name; var my_name;
/* /*
@ -94,7 +94,7 @@ describe('Atoms and atom names cache', function() {
function(err) { function(err) {
should.not.exist(err); should.not.exist(err);
should.exist(my_name); should.exist(my_name);
self.spy.reset(); self.spy.resetHistory();
self.X.InternAtom(true, my_name, function(err, atom) { self.X.InternAtom(true, my_name, function(err, atom) {
should.not.exist(err); should.not.exist(err);
my_atom.should.equal(atom); my_atom.should.equal(atom);

View file

@ -27,7 +27,7 @@ describe('ChangeProperty', function() {
var self = this; var self = this;
this.X.InternAtom(false, TEST_PROPERTY, function(err, atom) { this.X.InternAtom(false, TEST_PROPERTY, function(err, atom) {
should.not.exist(err); should.not.exist(err);
var raw = new Buffer(4); var raw = Buffer.alloc(4);
raw.writeUInt32LE(self.wid, 0); raw.writeUInt32LE(self.wid, 0);
self.X.ChangeProperty(0, self.wid, atom, self.X.atoms.WINDOW, 32, raw); self.X.ChangeProperty(0, self.wid, atom, self.X.atoms.WINDOW, 32, raw);
self.X.once('event', function(ev) { self.X.once('event', function(ev) {
@ -47,7 +47,7 @@ describe('ChangeProperty', function() {
var self = this; var self = this;
this.X.InternAtom(false, TEST_PROPERTY, function(err, atom) { this.X.InternAtom(false, TEST_PROPERTY, function(err, atom) {
should.not.exist(err); should.not.exist(err);
var raw = new Buffer(new Array(8)); var raw = Buffer.from(new Array(8));
raw.writeUInt32LE(self.wid, 0); raw.writeUInt32LE(self.wid, 0);
raw.writeUInt32LE(self.wid_helper, 4); raw.writeUInt32LE(self.wid_helper, 4);
self.X.ChangeProperty(0, self.wid, atom, self.X.atoms.ATOM, 32, raw); self.X.ChangeProperty(0, self.wid, atom, self.X.atoms.ATOM, 32, raw);
@ -69,7 +69,7 @@ describe('ChangeProperty', function() {
var self = this; var self = this;
this.X.InternAtom(false, TEST_PROPERTY, function(err, atom) { this.X.InternAtom(false, TEST_PROPERTY, function(err, atom) {
should.not.exist(err); should.not.exist(err);
var raw = new Buffer(0); var raw = Buffer.alloc(0);
self.X.ChangeProperty(0, self.wid, atom, self.X.atoms.WINDOW, 32, raw); self.X.ChangeProperty(0, self.wid, atom, self.X.atoms.WINDOW, 32, raw);
self.X.once('event', function(ev) { self.X.once('event', function(ev) {
ev.type.should.equal(28); ev.type.should.equal(28);

54
test/changeGC.js Normal file
View file

@ -0,0 +1,54 @@
var x11 = require('../lib');
var should = require('should');
describe('CreateGC', function() {
before(function(done) {
var self = this;
this.client = x11.createClient(function(err, dpy) {
should.not.exist(err);
self.X = dpy.client;
self.root = dpy.screen[0].root;
self.white = dpy.screen[0].white_pixel;
self.black = dpy.screen[0].black_pixel;
self.wid = self.X.AllocID();
self.X.CreateWindow(self.wid, self.root, 0, 0, 1, 1); // 1x1 pixel window
self.X.MapWindow(self.wid);
self.X.QueryTree(self.root, function(err, list) {
should.not.exist(err);
list.children.indexOf(self.wid).should.not.equal(-1);
done();
});
});
});
it('should create a Graphic Context correctly', function() {
var self = this;
this.client.on('error', function(err) {
should.not.exist(err);
});
this.gc = this.X.AllocID();
this.X.CreateGC(this.gc,
this.wid,
{
foreground: this.black,
background: this.white,
lineStyle : 0
}
);
this.X.ChangeGC(this.gc,
{
foreground: 0xffff00,
background: 0x0000ff,
lineStyle : 2
}
);
});
after(function(done) {
this.X.DestroyWindow(this.wid);
this.X.on('end', done);
this.X.terminate();
});
});

View file

@ -40,7 +40,7 @@ describe('ClientMessage', function() {
}); });
var X = dpy.client; var X = dpy.client;
var eventData = new Buffer(32); var eventData = Buffer.alloc(32);
eventData.writeInt8(33, 0); //Event Type 33 = ClientMessage eventData.writeInt8(33, 0); //Event Type 33 = ClientMessage
eventData.writeInt8(8, 1); //Format eventData.writeInt8(8, 1); //Format
eventData.writeInt32LE(self.wid, 4); //Window ID eventData.writeInt32LE(self.wid, 4); //Window ID
@ -67,7 +67,7 @@ describe('ClientMessage', function() {
}); });
var X = dpy.client; var X = dpy.client;
var eventData = new Buffer(32); var eventData = Buffer.alloc(32);
eventData.writeInt8(33, 0); //Event Type 33 = ClientMessage eventData.writeInt8(33, 0); //Event Type 33 = ClientMessage
eventData.writeInt8(16, 1); //Format eventData.writeInt8(16, 1); //Format
eventData.writeInt32LE(self.wid, 4); //Window ID eventData.writeInt32LE(self.wid, 4); //Window ID
@ -94,7 +94,7 @@ describe('ClientMessage', function() {
}); });
var X = dpy.client; var X = dpy.client;
var eventData = new Buffer(32); var eventData = Buffer.alloc(32);
eventData.writeInt8(33, 0); //Event Type 33 = ClientMessage eventData.writeInt8(33, 0); //Event Type 33 = ClientMessage
eventData.writeInt8(32, 1); //Format eventData.writeInt8(32, 1); //Format
eventData.writeInt32LE(self.wid, 4); //Window ID eventData.writeInt32LE(self.wid, 4); //Window ID

View file

@ -11,7 +11,7 @@ describe('KillKlient request', function() {
should.not.exist(err); should.not.exist(err);
display = dpy; display = dpy;
X = display.client; X = display.client;
root = display.screen[0].root; var root = display.screen[0].root;
var eventMask = x11.eventMask.SubstructureNotify; var eventMask = x11.eventMask.SubstructureNotify;
X.ChangeWindowAttributes(root, { eventMask: eventMask }); X.ChangeWindowAttributes(root, { eventMask: eventMask });
done(); done();