mirror of
https://github.com/danbulant/node-x11
synced 2026-05-19 04:18:35 +00:00
KillKlient and ForceScreenSaver requests
This commit is contained in:
parent
33775da6df
commit
ca5efc1941
3 changed files with 99 additions and 0 deletions
|
|
@ -608,6 +608,7 @@ module.exports = {
|
|||
}
|
||||
],
|
||||
|
||||
// todo: move up to keep reque
|
||||
GetGeometry: [
|
||||
function(drawable){
|
||||
return ['CxSL', [14, 2, drawable]]
|
||||
|
|
@ -624,5 +625,19 @@ module.exports = {
|
|||
ext.borderWith = res[5];
|
||||
return ext;
|
||||
}
|
||||
],
|
||||
|
||||
KillKlient: [
|
||||
function(resource) {
|
||||
return [ 'CxSL', [113, 2, resource] ];
|
||||
}
|
||||
],
|
||||
|
||||
ForceScreenSaver: [
|
||||
function(activate) {
|
||||
return [ 'CCS', [115, activate?1:0, 1] ];
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
43
test/core-ForceScreenSaver.js
Normal file
43
test/core-ForceScreenSaver.js
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
var x11 = require('../lib/x11');
|
||||
var should = require('should');
|
||||
var assert = require('assert');
|
||||
|
||||
describe('ForceScreenSaver request', function() {
|
||||
|
||||
var display;
|
||||
var X;
|
||||
beforeEach(function(done) {
|
||||
var client = x11.createClient(function(dpy) {
|
||||
display=dpy;
|
||||
X = display.client;
|
||||
done();
|
||||
});
|
||||
client.on('error', done);
|
||||
});
|
||||
|
||||
afterEach(function(done) {
|
||||
X.terminate();
|
||||
X.on('end', done);
|
||||
X = null;
|
||||
display = null;
|
||||
});
|
||||
|
||||
it('should exist as client member', function(done) {
|
||||
should.exist(X.ForceScreenSaver);
|
||||
assert.equal(typeof X.ForceScreenSaver, 'function');
|
||||
done();
|
||||
});
|
||||
|
||||
it('should be callable with true parameter', function(done) {
|
||||
X.ForceScreenSaver(true);
|
||||
// any way to check if it is running?
|
||||
done();
|
||||
});
|
||||
|
||||
it('should be callable with false parameter', function(done) {
|
||||
X.ForceScreenSaver(false);
|
||||
// any way to check if it is NOT running?
|
||||
done();
|
||||
});
|
||||
|
||||
});
|
||||
41
test/core-KillKlient.js
Normal file
41
test/core-KillKlient.js
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
var x11 = require('../lib/x11');
|
||||
var should = require('should');
|
||||
var assert = require('assert');
|
||||
|
||||
describe('KillKlient request', function() {
|
||||
|
||||
var display;
|
||||
var X;
|
||||
beforeEach(function(done) {
|
||||
var client = x11.createClient(function(dpy) {
|
||||
display=dpy;
|
||||
X = display.client;
|
||||
done();
|
||||
});
|
||||
client.on('error', done);
|
||||
});
|
||||
|
||||
afterEach(function(done) {
|
||||
X.terminate();
|
||||
X.on('end', done);
|
||||
X = null;
|
||||
display = null;
|
||||
});
|
||||
|
||||
it('should exist as client member', function(done) {
|
||||
should.exist(X.KillKlient);
|
||||
assert.equal(typeof X.KillKlient, 'function');
|
||||
done();
|
||||
});
|
||||
|
||||
it('should terminate other client connection', function(done) {
|
||||
x11.createClient(function(dpy) {
|
||||
var otherclient = dpy.client;
|
||||
var wnd = otherclient.AllocID();
|
||||
otherclient.CreateWindow(wnd, dpy.screen[0].root, 0, 0, 1, 1);
|
||||
otherclient.on('end', done);
|
||||
X.KillKlient(wnd);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
Loading…
Reference in a new issue