Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No PointerMotion or KeyPress events on root from on('event', ...) #207

Open
Cobertos opened this issue Jun 7, 2023 · 0 comments
Open

No PointerMotion or KeyPress events on root from on('event', ...) #207

Cobertos opened this issue Jun 7, 2023 · 0 comments

Comments

@Cobertos
Copy link

Cobertos commented Jun 7, 2023

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);
    });
});

no_x11_events

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?

@Cobertos Cobertos changed the title No Events from on('event', ...) No PointerMotion or KeyPress events on root from on('event', ...) Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant