mirror of
https://github.com/danbulant/node-x11
synced 2026-06-24 17:21:47 +00:00
Merge branch 'master' of https://github.com/sidorares/node-x11
This commit is contained in:
commit
7a2761b061
2 changed files with 50 additions and 6 deletions
54
README.md
54
README.md
|
|
@ -3,17 +3,61 @@
|
||||||
|
|
||||||
# status
|
# status
|
||||||
|
|
||||||
stage 2) ( see [roadmap.txt](node-x11/blob/master/roadmap.txt) )
|
[implemented requests documentation](https://github.com/sidorares/node-x11/wiki/Core-requests)
|
||||||
next todo: dispatch replies and errors, decode all evnt types
|
|
||||||
|
|
||||||
# example
|
# example
|
||||||
|
|
||||||
var X = require('x11').createClient();
|
Core requsests usage:
|
||||||
X.on('connect', function(display) {
|
|
||||||
|
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 root = display.screen[0].root;
|
||||||
|
var white = display.screen[0].white_pixel;
|
||||||
|
var black = display.screen[0].black_pixel;
|
||||||
|
|
||||||
var wid = X.AllocID();
|
var wid = X.AllocID();
|
||||||
X.CreateWindow(wid, root, 10, 10, 400, 300, 1, 1, 0, { backgroundPixel: 0, eventMask: 0x00000040 });
|
X.CreateWindow(
|
||||||
|
wid, root,
|
||||||
|
0, 0, 100, 100,
|
||||||
|
1, 1, 0,
|
||||||
|
{
|
||||||
|
backgroundPixel: white, eventMask: Exposure|PointerMotion
|
||||||
|
}
|
||||||
|
);
|
||||||
X.MapWindow(wid);
|
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.PolyText8(wid, gc, 50, 50, ['Hello, Node.JS!']);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
X.on('error', function(e) {
|
||||||
|
console.log(e);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Simple core requests Window wrapper:
|
||||||
|
|
||||||
|
var x11 = require('x11');
|
||||||
|
var Window = require('./wndwrap');
|
||||||
|
var xclient = x11.createClient();
|
||||||
|
xclient.on('connect', function(display) {
|
||||||
|
var mainwnd = new Window(xclient, 0, 0, 100, 100);
|
||||||
|
mainwnd.on('expose', function(ev) {
|
||||||
|
ev.gc.drawText(50, 50, 'Hello, NodeJS!');
|
||||||
|
});
|
||||||
|
mainwnd.map();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
7) vnc client using https://github.com/substack/node-rfb
|
7) vnc client using https://github.com/substack/node-rfb
|
||||||
8) rdesktop client using https://github.com/substack/node-rdesktop
|
8) rdesktop client using https://github.com/substack/node-rdesktop
|
||||||
9) widget implementing basic subset of html5 canvas api using https://github.com/learnboost/node-canvas or https://github.com/ajaxorg/node-o3-canvas
|
9) widget implementing basic subset of html5 canvas api using https://github.com/learnboost/node-canvas or https://github.com/ajaxorg/node-o3-canvas
|
||||||
10) pdf viewer using https://github.com/andreasgal/pdf.js/
|
10) pdf viewer using https://github.com/andreasgal/pdf.js/, (ODF viewer? - http://webodf.org/demo/)
|
||||||
12) ICCCM library http://www.x.org/docs/ICCCM/icccm.pdf http://tronche.com/gui/x/icccm/
|
12) ICCCM library http://www.x.org/docs/ICCCM/icccm.pdf http://tronche.com/gui/x/icccm/
|
||||||
11) pure js window manager
|
11) pure js window manager
|
||||||
12) general purpose widgets set, layout managers, box model
|
12) general purpose widgets set, layout managers, box model
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue