From 9ff1b645d148d2f54f5ded270cba48971f514a0b Mon Sep 17 00:00:00 2001 From: Svetlana Linuxenko Date: Thu, 17 Nov 2016 12:12:20 +0200 Subject: [PATCH] screenshot example fix --- examples/screenshot.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) mode change 100755 => 100644 examples/screenshot.js diff --git a/examples/screenshot.js b/examples/screenshot.js old mode 100755 new mode 100644 index b41f8d7..2d7f366 --- a/examples/screenshot.js +++ b/examples/screenshot.js @@ -17,7 +17,7 @@ x11.createClient(function(err, display) { var dispwin = X.AllocID(); - X.CreateWindow(dispwin, root, 0, 0, width, height, 1, 1, 0, { eventMask: x11.eventMask.Exposure }); + X.CreateWindow(dispwin, root, 0, 0, width, height, 0, 0, 0, 0, { eventMask: x11.eventMask.Exposure }); X.MapWindow(dispwin); //X.CopyArea(idScreenshot, dispwin, gc, 0, 0, 0, 0, width, height); @@ -71,7 +71,11 @@ x11.createClient(function(err, display) { }); */ - X.GetImage(2, root, 0, 0, width, height, 0xffffffff, function(image) { + X.GetImage(2, id, 0, 0, width, height, 0xffffffff, function(err, image) { + if (err) { + console.log(err); + process.exit(1); + } console.log(image); // format, drawable, gc, width, height, dstX, dstY, leftPad, depth, data X.PutImage(2, dispwin, gc, width, height, 0, 0, 0, 24, image.data);