mirror of
https://github.com/danbulant/node-x11
synced 2026-05-19 04:18:35 +00:00
make text example work when default bg color is black
This commit is contained in:
parent
ce51cefdad
commit
4c6617c994
1 changed files with 80 additions and 59 deletions
139
README.md
139
README.md
|
|
@ -1,6 +1,6 @@
|
|||
# node-x11
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
[](https://gitter.im/sidorares/node-x11?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](http://travis-ci.org/sidorares/node-x11)
|
||||
|
|
@ -10,45 +10,65 @@
|
|||
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 ))
|
||||
|
||||
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:
|
||||
|
||||
```js
|
||||
/*
|
||||
var nomnoml = require('nomnoml');
|
||||
var src = '[nomnoml] is -> [awesome]';
|
||||
console.log(nomnoml.renderSvg(src));
|
||||
*/
|
||||
|
||||
var x11 = require('x11');
|
||||
|
||||
var Exposure = x11.eventMask.Exposure;
|
||||
var PointerMotion = x11.eventMask.PointerMotion;
|
||||
|
||||
x11.createClient(function(err, display) {
|
||||
if (!err) {
|
||||
var X = display.client;
|
||||
var root = display.screen[0].root;
|
||||
var wid = X.AllocID();
|
||||
X.CreateWindow(
|
||||
wid, root, // new window id, parent
|
||||
0, 0, 100, 100, // x, y, w, h
|
||||
0, 0, 0, 0, // border, depth, class, visual
|
||||
{ eventMask: Exposure|PointerMotion } // other parameters
|
||||
);
|
||||
X.MapWindow(wid);
|
||||
var gc = X.AllocID();
|
||||
X.CreateGC(gc, wid);
|
||||
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);
|
||||
});
|
||||
} else {
|
||||
console.log(err);
|
||||
}
|
||||
if (!err) {
|
||||
var X = display.client;
|
||||
var root = display.screen[0].root;
|
||||
var wid = X.AllocID();
|
||||
X.CreateWindow(
|
||||
wid,
|
||||
root, // new window id, parent
|
||||
0,
|
||||
0,
|
||||
500,
|
||||
500, // x, y, w, h
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0, // border, depth, class, visual
|
||||
{ eventMask: Exposure | PointerMotion } // other parameters
|
||||
);
|
||||
X.MapWindow(wid);
|
||||
var gc = X.AllocID();
|
||||
X.CreateGC(gc, wid);
|
||||
var white = display.screen[0].white_pixel;
|
||||
var black = display.screen[0].black_pixel;
|
||||
cidBlack = X.AllocID();
|
||||
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);
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
|
|
@ -60,45 +80,46 @@ x11.createClient(function(err, display) {
|
|||

|
||||
|
||||
## 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
|
||||
|
||||
- [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:
|
||||
|
||||
- [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)
|
||||
- [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)
|
||||
|
||||
## Other implementations
|
||||
|
||||
- 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 )
|
||||
- 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 )
|
||||
|
||||
## Server side (protocol + functionality) implementations for js + DOM
|
||||
|
||||
would be really great to make completely web based playground page, connecting node-x11 api to DOM based implementation
|
||||
|
||||
- https://github.com/GothAck/javascript-x-server
|
||||
- https://github.com/ttaubert/x-server-js
|
||||
- https://github.com/GothAck/javascript-x-server
|
||||
- https://github.com/ttaubert/x-server-js
|
||||
|
|
|
|||
Loading…
Reference in a new issue