From c70adf725d3fea94eabdde467b8b8b106a796c0a Mon Sep 17 00:00:00 2001 From: Reinhard Tartler Date: Sun, 13 Nov 2011 09:53:12 +0100 Subject: Imported nxcompshad-3.4.0-3.tar.gz Summary: Imported nxcompshad-3.4.0-3.tar.gz Keywords: Imported nxcompshad-3.4.0-3.tar.gz into Git repository --- nxcompshad/CHANGELOG | 13 +++++++ nxcompshad/Core.cpp | 2 +- nxcompshad/Core.h | 2 +- nxcompshad/Input.cpp | 2 +- nxcompshad/Input.h | 2 +- nxcompshad/LICENSE | 2 +- nxcompshad/Logger.cpp | 2 +- nxcompshad/Logger.h | 2 +- nxcompshad/Makefile.in | 2 +- nxcompshad/Manager.cpp | 2 +- nxcompshad/Manager.h | 2 +- nxcompshad/Misc.h | 2 +- nxcompshad/Poller.h | 2 +- nxcompshad/Regions.h | 2 +- nxcompshad/Shadow.cpp | 2 +- nxcompshad/Shadow.cpp.orig | 2 +- nxcompshad/Shadow.h | 2 +- nxcompshad/Updater.cpp | 2 +- nxcompshad/Updater.h | 2 +- nxcompshad/Win.cpp | 2 +- nxcompshad/Win.h | 2 +- nxcompshad/X11.cpp | 93 ++++++++++++++++++++++++++++++++-------------- nxcompshad/X11.h | 2 +- 23 files changed, 100 insertions(+), 48 deletions(-) diff --git a/nxcompshad/CHANGELOG b/nxcompshad/CHANGELOG index 27bc0aca1..ea1ff455c 100644 --- a/nxcompshad/CHANGELOG +++ b/nxcompshad/CHANGELOG @@ -1,5 +1,18 @@ ChangeLog: +nxcompshad-3.4.0-3 + +- Updated copyright to year 2010. + +nxcompshad-3.4.0-2 + +- Fixed TR08G02256. Now the Shadow session is shown correctly with + MIT-SHM extension disabled. + +- Improved updateShadowFrameBuffer() and ~Poller() functions. + +- Avoided memory leak. + nxcompshad-3.4.0-1 - Opened the 3.4.0 branch based on nxcompshad-3.3.0-3. diff --git a/nxcompshad/Core.cpp b/nxcompshad/Core.cpp index 44327cd3f..6052de6cc 100644 --- a/nxcompshad/Core.cpp +++ b/nxcompshad/Core.cpp @@ -1,6 +1,6 @@ /**************************************************************************/ /* */ -/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */ +/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of NoMachine. Redistribution and use of the present */ diff --git a/nxcompshad/Core.h b/nxcompshad/Core.h index 17ce44881..b0a994329 100644 --- a/nxcompshad/Core.h +++ b/nxcompshad/Core.h @@ -1,6 +1,6 @@ /**************************************************************************/ /* */ -/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */ +/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of NoMachine. Redistribution and use of the present */ diff --git a/nxcompshad/Input.cpp b/nxcompshad/Input.cpp index c51c5d3b3..09e77a8ef 100644 --- a/nxcompshad/Input.cpp +++ b/nxcompshad/Input.cpp @@ -1,6 +1,6 @@ /**************************************************************************/ /* */ -/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */ +/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of NoMachine. Redistribution and use of the present */ diff --git a/nxcompshad/Input.h b/nxcompshad/Input.h index 64775c290..764508e03 100644 --- a/nxcompshad/Input.h +++ b/nxcompshad/Input.h @@ -1,6 +1,6 @@ /**************************************************************************/ /* */ -/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */ +/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of NoMachine. Redistribution and use of the present */ diff --git a/nxcompshad/LICENSE b/nxcompshad/LICENSE index bf103c899..99d6e5cbc 100644 --- a/nxcompshad/LICENSE +++ b/nxcompshad/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2001, 2009 NoMachine - http://www.nomachine.com/. +Copyright (c) 2001, 2010 NoMachine - http://www.nomachine.com/. NXCOMPSHAD and NX extensions to X are copyright of NoMachine. diff --git a/nxcompshad/Logger.cpp b/nxcompshad/Logger.cpp index 1f55ce9b1..47e5e6391 100644 --- a/nxcompshad/Logger.cpp +++ b/nxcompshad/Logger.cpp @@ -1,6 +1,6 @@ /**************************************************************************/ /* */ -/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com. */ +/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of NoMachine. Redistribution and use of the present */ diff --git a/nxcompshad/Logger.h b/nxcompshad/Logger.h index 4eff83e5a..0a9cad95f 100644 --- a/nxcompshad/Logger.h +++ b/nxcompshad/Logger.h @@ -1,6 +1,6 @@ /**************************************************************************/ /* */ -/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com. */ +/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of NoMachine. Redistribution and use of the present */ diff --git a/nxcompshad/Makefile.in b/nxcompshad/Makefile.in index c7c22ad06..eaf5cabcf 100755 --- a/nxcompshad/Makefile.in +++ b/nxcompshad/Makefile.in @@ -1,6 +1,6 @@ ############################################################################ # # -# Copyright (c) 2001, 2005 NoMachine, http://www.nomachine.com. # +# Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. # # # # NXCOMP, NX protocol compression and NX extensions to this software # # are copyright of NoMachine. Redistribution and use of the present # diff --git a/nxcompshad/Manager.cpp b/nxcompshad/Manager.cpp index 92a7cdaee..38b92c20c 100644 --- a/nxcompshad/Manager.cpp +++ b/nxcompshad/Manager.cpp @@ -1,6 +1,6 @@ /**************************************************************************/ /* */ -/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */ +/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of NoMachine. Redistribution and use of the present */ diff --git a/nxcompshad/Manager.h b/nxcompshad/Manager.h index 22f6b159c..6f87cdccf 100644 --- a/nxcompshad/Manager.h +++ b/nxcompshad/Manager.h @@ -1,6 +1,6 @@ /**************************************************************************/ /* */ -/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */ +/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of NoMachine. Redistribution and use of the present */ diff --git a/nxcompshad/Misc.h b/nxcompshad/Misc.h index 6bfbaa4fb..3bcb26653 100644 --- a/nxcompshad/Misc.h +++ b/nxcompshad/Misc.h @@ -1,6 +1,6 @@ /**************************************************************************/ /* */ -/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */ +/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of NoMachine. Redistribution and use of the present */ diff --git a/nxcompshad/Poller.h b/nxcompshad/Poller.h index 489ba305d..914ba1d07 100644 --- a/nxcompshad/Poller.h +++ b/nxcompshad/Poller.h @@ -1,6 +1,6 @@ /**************************************************************************/ /* */ -/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */ +/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of NoMachine. Redistribution and use of the present */ diff --git a/nxcompshad/Regions.h b/nxcompshad/Regions.h index 6e6827fc4..8ea41ad1d 100644 --- a/nxcompshad/Regions.h +++ b/nxcompshad/Regions.h @@ -1,6 +1,6 @@ /**************************************************************************/ /* */ -/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */ +/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of NoMachine. Redistribution and use of the present */ diff --git a/nxcompshad/Shadow.cpp b/nxcompshad/Shadow.cpp index e336ca679..6f2856ce1 100644 --- a/nxcompshad/Shadow.cpp +++ b/nxcompshad/Shadow.cpp @@ -1,6 +1,6 @@ /**************************************************************************/ /* */ -/* Copyright (c) 2001, 2009 NoMachine, http://www.nomachine.com. */ +/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of NoMachine. Redistribution and use of the present */ diff --git a/nxcompshad/Shadow.cpp.orig b/nxcompshad/Shadow.cpp.orig index 91ef3b85a..206eb2eaf 100644 --- a/nxcompshad/Shadow.cpp.orig +++ b/nxcompshad/Shadow.cpp.orig @@ -1,6 +1,6 @@ /**************************************************************************/ /* */ -/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com. */ +/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of NoMachine. Redistribution and use of the present */ diff --git a/nxcompshad/Shadow.h b/nxcompshad/Shadow.h index 57a77255e..ef65c0b2a 100644 --- a/nxcompshad/Shadow.h +++ b/nxcompshad/Shadow.h @@ -1,6 +1,6 @@ /**************************************************************************/ /* */ -/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com. */ +/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of NoMachine. Redistribution and use of the present */ diff --git a/nxcompshad/Updater.cpp b/nxcompshad/Updater.cpp index 3f0e6a4da..f1761ba66 100644 --- a/nxcompshad/Updater.cpp +++ b/nxcompshad/Updater.cpp @@ -1,6 +1,6 @@ /**************************************************************************/ /* */ -/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */ +/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of NoMachine. Redistribution and use of the present */ diff --git a/nxcompshad/Updater.h b/nxcompshad/Updater.h index 386c72639..4bcaa9176 100644 --- a/nxcompshad/Updater.h +++ b/nxcompshad/Updater.h @@ -1,6 +1,6 @@ /**************************************************************************/ /* */ -/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */ +/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of NoMachine. Redistribution and use of the present */ diff --git a/nxcompshad/Win.cpp b/nxcompshad/Win.cpp index 87ea80bf5..3f1e489e2 100644 --- a/nxcompshad/Win.cpp +++ b/nxcompshad/Win.cpp @@ -1,6 +1,6 @@ /**************************************************************************/ /* */ -/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */ +/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of NoMachine. Redistribution and use of the present */ diff --git a/nxcompshad/Win.h b/nxcompshad/Win.h index 934382190..72566b8f4 100644 --- a/nxcompshad/Win.h +++ b/nxcompshad/Win.h @@ -1,6 +1,6 @@ /**************************************************************************/ /* */ -/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */ +/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of NoMachine. Redistribution and use of the present */ diff --git a/nxcompshad/X11.cpp b/nxcompshad/X11.cpp index 837efad71..cb8f55fc5 100644 --- a/nxcompshad/X11.cpp +++ b/nxcompshad/X11.cpp @@ -1,6 +1,6 @@ /**************************************************************************/ /* */ -/* Copyright (c) 2001, 2009 NoMachine, http://www.nomachine.com/. */ +/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of NoMachine. Redistribution and use of the present */ @@ -127,7 +127,7 @@ Poller::~Poller() XCloseDisplay(display_); } - if (tmpBuffer_ != NULL && shmExtension_ == 1 && damageExtension_ == 1) + if (tmpBuffer_ != NULL && shmExtension_ != -1 && damageExtension_ == 1) { XFree(tmpBuffer_); @@ -181,13 +181,21 @@ int Poller::updateShadowFrameBuffer(void) return -1; } - - return 1; } else { - return 0; + image_ = XGetImage(display_, DefaultRootWindow(display_), 0, 0, width_, + height_, AllPlanes, ZPixmap); + + if (image_ == NULL) + { + logDebug("Poller::updateShadowFrameBuffer", "XGetImage failed!"); + + return -1; + } } + + return 1; } char *Poller::getRect(XRectangle r) @@ -255,6 +263,8 @@ char *Poller::getRect(XRectangle r) } XFree(image_); + + image_ = NULL; } return tmpBuffer_; @@ -1469,42 +1479,71 @@ void Poller::handleDamageNotify(XEvent *X) void Poller::updateDamagedAreas(void) { - if (shmExtension_ == 1) - { - BOX *boxPtr; + BOX *boxPtr; - XRectangle rectangle; + XRectangle rectangle; - int i; - int y; + int i; + int y; + + for (i = 0; i < lastUpdatedRegion_ -> numRects; i++) + { + boxPtr = lastUpdatedRegion_ -> rects + i; - for (i = 0; i < lastUpdatedRegion_ -> numRects; i++) + if (shmExtension_ == 1) { - boxPtr = lastUpdatedRegion_ -> rects + i; - image_ -> width = boxPtr -> x2 - boxPtr -> x1; - image_ -> height = boxPtr -> y2 - boxPtr -> y1; + image_ -> height = boxPtr -> y2 - boxPtr -> y1; + image_ -> bytes_per_line = + ROUNDUP((image_ -> bits_per_pixel * image_ -> width), + image_ -> bitmap_pad); + + if (XShmGetImage(display_, DefaultRootWindow(display_), image_, + boxPtr -> x1, boxPtr -> y1, AllPlanes) == 0) + { + logDebug("Poller::updateDamagedAreas", "XShmGetImage failed!"); - image_ -> bytes_per_line = ROUNDUP((image_ -> bits_per_pixel * image_ -> width), image_ -> bitmap_pad); + return; + } + } + else if (shmExtension_ == 0) + { + image_ = XGetImage(display_, DefaultRootWindow(display_), boxPtr -> x1, + boxPtr -> y1, boxPtr -> x2 - boxPtr -> x1, + boxPtr -> y2 - boxPtr -> y1, AllPlanes, + ZPixmap); - if (XShmGetImage(display_, DefaultRootWindow(display_), image_, boxPtr -> x1, boxPtr -> y1, AllPlanes) == 0) + if (image_ == NULL) { - logDebug("Poller::getRect", "XShmGetImage failed!"); + logDebug("Poller::updateDamagedAreas", "XGetImage failed!"); return; } - rectangle.height = 1; - rectangle.width = image_ -> width; - rectangle.x = boxPtr -> x1; - rectangle.y = boxPtr -> y1; + image_ -> width = boxPtr -> x2 - boxPtr -> x1; + image_ -> height = boxPtr -> y2 - boxPtr -> y1; + image_ -> bytes_per_line = + ROUNDUP((image_ -> bits_per_pixel * image_ -> width), + image_ -> bitmap_pad); + } + + rectangle.height = 1; + rectangle.width = image_ -> width; + rectangle.x = boxPtr -> x1; + rectangle.y = boxPtr -> y1; - for (y = 0; y < image_ -> height; y++) - { - update(image_ -> data + y * image_ -> bytes_per_line, rectangle); + for (y = 0; y < image_ -> height; y++) + { + update(image_ -> data + y * image_ -> bytes_per_line, rectangle); - rectangle.y++; - } + rectangle.y++; + } + + if (shmExtension_ != 1) + { + XDestroyImage(image_); + + image_ = NULL; } } diff --git a/nxcompshad/X11.h b/nxcompshad/X11.h index ff14aaea4..d34fd3dba 100644 --- a/nxcompshad/X11.h +++ b/nxcompshad/X11.h @@ -1,6 +1,6 @@ /**************************************************************************/ /* */ -/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */ +/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of NoMachine. Redistribution and use of the present */ -- cgit v1.2.3