From 67c34d1b0aec04897e39dd16ebeeb6a43acd5a90 Mon Sep 17 00:00:00 2001 From: sbosse Date: Mon, 21 Jul 2025 23:01:26 +0200 Subject: [PATCH] Mon 21 Jul 22:43:21 CEST 2025 --- js/x11/core/examples/smoketest/testwnd.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 js/x11/core/examples/smoketest/testwnd.js diff --git a/js/x11/core/examples/smoketest/testwnd.js b/js/x11/core/examples/smoketest/testwnd.js new file mode 100644 index 0000000..2754391 --- /dev/null +++ b/js/x11/core/examples/smoketest/testwnd.js @@ -0,0 +1,23 @@ +var x11 = require('../../lib'); +var Window = require('./wndwrap'); + +var width = 700; +var height = 500; + +var pts = []; +x11.createClient(function(err, display) { + + var mainwnd = new Window(display.client, 0, 0, width, height); + mainwnd.on('mousemove', function(ev) + { + pts.push(ev.x); + pts.push(ev.y); + this.gc.text(ev.x, ev.y, 'Hello, NodeJS!'); + mainwnd.title = ev.x + ' ' + ev.y; + }); + mainwnd.on('expose', function(ev) { + for (var i=0; i < pts.length/2 ; ++i) + ev.gc.drawText(pts[i], pts[i+1], 'Hello, NodeJS!'); + }); + mainwnd.map(); +});