From 8e5758238fa8b18bf4b8d3d7ac79a7f4bbd7cbc0 Mon Sep 17 00:00:00 2001 From: sidorares Date: Thu, 14 Jul 2011 16:39:59 +1000 Subject: [PATCH] UnmapWindow request --- lib/x11/corereqs.js | 7 ++++++- test/map_unmap.js | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 test/map_unmap.js diff --git a/lib/x11/corereqs.js b/lib/x11/corereqs.js index 0a6b1aa..e0a08a6 100644 --- a/lib/x11/corereqs.js +++ b/lib/x11/corereqs.js @@ -92,8 +92,13 @@ module.exports = { } ], + MapWindow: [ // 8 - opcode, 2 - length [ 'CxSL', [8, 2] ] - ] + ], + + UnmapWindow: [ + [ 'CxSL', [10, 2] ] + ] } diff --git a/test/map_unmap.js b/test/map_unmap.js new file mode 100644 index 0000000..80d0dcc --- /dev/null +++ b/test/map_unmap.js @@ -0,0 +1,21 @@ +var x11 = require('../lib/x11'); + +var xclient = x11.createClient(); +var mapped = true; +xclient.on('connect', function(display) { + var X = this; + var root = display.screen[0].root; + var wid = X.AllocID(); + + X.CreateWindow(wid, root, 10, 10, 400, 300, 1, 1, 0, { backgroundPixel: 0, eventMask: 0x00000040 }); + X.MapWindow(wid); + setInterval(function() { + if (!mapped) { + X.MapWindow(wid); + } else { + X.UnmapWindow(wid); + } + mapped = !mapped; + }, 1000); + +}); \ No newline at end of file