Mon 21 Jul 22:43:21 CEST 2025
This commit is contained in:
parent
524b6c04ae
commit
95a4fab307
13
js/x11/examples/simple/events.js
Normal file
13
js/x11/examples/simple/events.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
var x11 = require('../../lib');
|
||||
x11.createClient(function(err, display) {
|
||||
var X = display.client;
|
||||
var wid = X.AllocID();
|
||||
X.CreateWindow(wid, display.screen[0].root, 100, 100, 400, 300);
|
||||
X.ChangeWindowAttributes(wid, { eventMask: x11.eventMask.PointerMotion|x11.eventMask.KeyPress });
|
||||
X.MapWindow(wid)
|
||||
X.on('event', function(ev) {
|
||||
if (ev.type === 2) // keypress
|
||||
X.terminate();
|
||||
console.log(ev);
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user