No PointerMotion or KeyPress events on root from `on('event', ...)`
Cobertos opened this issue · 0 comments
Cobertos commented
I ran some code from #69 to debug why my events weren't firing. When I run the below code, NO events show up on my system.
var x11 = require('x11');
x11.createClient(function(err, display) {
var X = display.client;
var root = display.screen[0].root;
X.ChangeWindowAttributes(root, { eventMask: x11.eventMask.PointerMotion|x11.eventMask.KeyPress });
X.on('event', function(ev) {
console.log(ev);
});
});
I also tried the below code to see all possible events I could get
var x11 = require('../../lib');
x11.createClient(function(err, display) {
var X = display.client;
var root = display.screen[0].root;
const mask = Object.entries(x11.eventMask)
.filter(([k,v])=>k !== "SubstructureRedirect")
.map(([k,v])=>v)
.reduce((acc,i)=>acc|i,0x0);
X.ChangeWindowAttributes(root, { eventMask: mask });
const uniq = [];
X.on('event', function(ev) {
const name = ev.name || ev.type;
if (!uniq.includes(name)) {
console.log(name);
uniq.push(name);
}
});
});
and I was able to see
ConfigureNotify
PropertyNotify
32
ClientMessage
MapNotify
UnmapNotify
CreateNotify
DestroyNotify
21
Lastly, I tried the Tetris game and I can get key presses and pointer motion when it's on a window I create, but I can't target a different window?
Any ideas why PointerMotion and KeyPress won't show up on my system?