mirror of
https://github.com/danbulant/node-x11
synced 2026-05-22 05:49:11 +00:00
add EnterWindow event, and give events names
This commit is contained in:
parent
78673cbb94
commit
7fc33f3bab
1 changed files with 22 additions and 2 deletions
24
lib/xcore.js
24
lib/xcore.js
|
|
@ -251,6 +251,7 @@ XClient.prototype.unpackEvent = function(type, seq, extra, code, raw)
|
|||
var values = raw.unpack('LLLssssSC');
|
||||
//event.raw = values;
|
||||
// TODO: use unpackTo???
|
||||
event.name = [,,'KeyPress', 'KeyRelease', 'MouseDown', 'MouseUp', 'MouseMove'][type]
|
||||
event.time = extra;
|
||||
event.keycode = code;
|
||||
event.root = values[0];
|
||||
|
|
@ -262,8 +263,21 @@ XClient.prototype.unpackEvent = function(type, seq, extra, code, raw)
|
|||
event.y = values[6];
|
||||
event.buttons = values[7];
|
||||
event.sameScreen = values[8];
|
||||
} else if (type == 7) { //EnterWindow
|
||||
event.name = 'EnterWindow'
|
||||
var values = raw.unpack('LLLssssSC');
|
||||
event.root = values[0]
|
||||
event.wid = values[1]
|
||||
event.child = values[2];
|
||||
event.rootx = values[3];
|
||||
event.rooty = values[4];
|
||||
event.x = values[5];
|
||||
event.y = values[6];
|
||||
event.values = values
|
||||
|
||||
} else if (type == 12) { // Expose
|
||||
var values = raw.unpack('SSSSS');
|
||||
event.name = 'Expose'
|
||||
event.wid = extra;
|
||||
event.x = values[0];
|
||||
event.y = values[1];
|
||||
|
|
@ -272,6 +286,7 @@ XClient.prototype.unpackEvent = function(type, seq, extra, code, raw)
|
|||
event.count = values[4]; // TODO: ???
|
||||
} else if (type == 16) { // CreateNotify
|
||||
var values = raw.unpack('LLssSSSc');
|
||||
event.name = 'CreateNotify'
|
||||
event.parent = extra;
|
||||
event.wid = values[0];
|
||||
event.x = values[2];
|
||||
|
|
@ -282,18 +297,22 @@ XClient.prototype.unpackEvent = function(type, seq, extra, code, raw)
|
|||
// x, y, width, height, border
|
||||
} else if (type == 17) { // destroy notify
|
||||
var values = raw.unpack('LL');
|
||||
event.name = 'DestroyNotify'
|
||||
event.wid = extra;
|
||||
event.wid1 = values[0];
|
||||
} else if (type == 19) { // MapNotify
|
||||
var values = raw.unpack('LLC');
|
||||
event.name = 'MapNotify'
|
||||
event.wid = extra;
|
||||
event.wid1 = values[0];
|
||||
} else if (type == 20) {
|
||||
var values = raw.unpack('LL');
|
||||
event.name = 'MapRequest'
|
||||
event.parent = extra;
|
||||
event.wid = values[0];
|
||||
} else if (type == 22) {
|
||||
var values = raw.unpack('LLssSSSC');
|
||||
event.name = 'Overlap' //?
|
||||
event.wid = extra;
|
||||
event.wid1 = values[0];
|
||||
event.aboveSibling = values[1];
|
||||
|
|
@ -305,6 +324,7 @@ XClient.prototype.unpackEvent = function(type, seq, extra, code, raw)
|
|||
event.overrideRedirect = values[7];
|
||||
} else if (type == 23) {
|
||||
var values = raw.unpack('LLLssSSS');
|
||||
event.name = 'ConfigureRequest'
|
||||
event.parent = extra;
|
||||
event.wid = values[0];
|
||||
event.x = values[1]
|
||||
|
|
@ -519,11 +539,11 @@ module.exports.createClient = function(options, initCb)
|
|||
//socketPath = '/tmp/.X11-unix/X' + displayNum;
|
||||
if(socketPath)
|
||||
{
|
||||
stream = net.createConnection(socketPath);
|
||||
stream = net.createConnection(socketPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
stream = net.createConnection(6000 + parseInt(displayNum), host);
|
||||
stream = net.createConnection(6000 + parseInt(displayNum), host);
|
||||
}
|
||||
var client = new XClient(stream, displayNum, screenNum, options);
|
||||
if (initCb)
|
||||
|
|
|
|||
Loading…
Reference in a new issue