mirror of
https://github.com/danbulant/node-x11
synced 2026-06-15 12:41:29 +00:00
Get/SetSelectionOwner requests
This commit is contained in:
parent
771330201b
commit
06d87c5908
2 changed files with 34 additions and 0 deletions
13
examples/smoketest/selections.js
Normal file
13
examples/smoketest/selections.js
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
var x11 = require('../../lib/x11');
|
||||
|
||||
x11.createClient(function(display) {
|
||||
var X = display.client;
|
||||
var id = parseInt(process.argv[2]);
|
||||
var root = display.screen[0].root;
|
||||
X.SetSelectionOwner(root, X.atoms.PRIMARY);
|
||||
X.GetSelectionOwner(X.atoms.PRIMARY, function(err, win) {
|
||||
console.log(err, win, root);
|
||||
});
|
||||
X.on('event', console.log);
|
||||
X.on('error', console.error);
|
||||
});
|
||||
|
|
@ -334,6 +334,27 @@ module.exports = {
|
|||
}
|
||||
],
|
||||
|
||||
SetSelectionOwner: [
|
||||
function(owner, selection, time)
|
||||
{
|
||||
if (!time)
|
||||
time = 0; // current time
|
||||
return ['CxSLLL', [22, 4, owner, selection, time]];
|
||||
}
|
||||
],
|
||||
|
||||
GetSelectionOwner: [
|
||||
function(selection)
|
||||
{
|
||||
return ['CxSL', [23, 2, selection]];
|
||||
},
|
||||
|
||||
function(buf) {
|
||||
console.log(buf);
|
||||
return buf.unpack('L')[0];
|
||||
}
|
||||
],
|
||||
|
||||
SendEvent: [
|
||||
|
||||
function(destination, propagate, eventMask, eventRawData)
|
||||
|
|
|
|||
Loading…
Reference in a new issue