"Fossies" - the Fresh Open Source Software Archive

Member "tvnserver-2.0.4/fb-update-sender/UpdateSender.h" (3 Aug 2011, 4901 Bytes) of archive /windows/misc/tvnserver-2.0.4-src.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "UpdateSender.h" see the Fossies "Dox" file reference documentation.

    1 // Copyright (C) 2008, 2009, 2010 GlavSoft LLC.
    2 // All rights reserved.
    3 //
    4 //-------------------------------------------------------------------------
    5 // This file is part of the TightVNC software.  Please visit our Web site:
    6 //
    7 //                       http://www.tightvnc.com/
    8 //
    9 // This program is free software; you can redistribute it and/or modify
   10 // it under the terms of the GNU General Public License as published by
   11 // the Free Software Foundation; either version 2 of the License, or
   12 // (at your option) any later version.
   13 //
   14 // This program is distributed in the hope that it will be useful,
   15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
   16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   17 // GNU General Public License for more details.
   18 //
   19 // You should have received a copy of the GNU General Public License along
   20 // with this program; if not, write to the Free Software Foundation, Inc.,
   21 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
   22 //-------------------------------------------------------------------------
   23 //
   24 
   25 #ifndef __UPDATESENDER_H__
   26 #define __UPDATESENDER_H__
   27 
   28 #include "thread/AutoLock.h"
   29 #include "thread/Thread.h"
   30 #include "desktop/UpdateKeeper.h"
   31 #include "UpdateRequestListener.h"
   32 #include "rfb/FrameBuffer.h"
   33 #include "desktop/WindowsMouseGrabber.h"
   34 #include "ViewPort.h"
   35 #include "FrameBufferAccessor.h"
   36 #include "network/RfbOutputGate.h"
   37 #include "network/RfbInputGate.h"
   38 #include "rfb/Encoder.h"
   39 #include "rfb/HextileEncoder.h"
   40 #include "rfb/JpegEncoder.h"
   41 #include "rfb/EncoderStore.h"
   42 #include "rfb-sconn/RfbCodeRegistrator.h"
   43 #include "util/DateTime.h"
   44 
   45 class UpdateSender : public Thread, public RfbDispatcherListener
   46 {
   47 public:
   48   UpdateSender(RfbCodeRegistrator *codeRegtor,
   49                UpdateRequestListener *updReqListener, RfbOutputGate *output,
   50                int id);
   51   virtual ~UpdateSender(void);
   52 
   53   void init(const Dimension *fbDim, const PixelFormat *pf);
   54 
   55   void newUpdates(const UpdateContainer *updateContainer,
   56                   const FrameBuffer *frameBuffer,
   57                   const CursorShape *cursorShape,
   58                   const Rect *viewPort);
   59 
   60   void blockCursorPosSending();
   61 
   62   bool isCursorPosBlocked();
   63 
   64   Rect getViewPort();
   65 
   66   bool clientIsReady();
   67 
   68 protected:
   69   virtual void onRequest(UINT32 reqCode, RfbInputGate *input);
   70 
   71   void readUpdateRequest(RfbInputGate *io);
   72   void readSetPixelFormat(RfbInputGate *io);
   73   void readSetEncodings(RfbInputGate *io);
   74 
   75   void addUpdateContainer(const UpdateContainer *updateContainer,
   76                           const FrameBuffer *srcFb,
   77                           const Rect *viewPort);
   78 
   79   virtual void execute();
   80   virtual void onTerminate();
   81 
   82   void checkCursorPos(UpdateContainer *updCont,
   83                       const Rect *viewPort);
   84 
   85   void sendUpdate();
   86 
   87   void sendPalette(PixelFormat *pf);
   88 
   89   void setClientPixelFormat(const PixelFormat *pf,
   90                             bool clrMapEntries);
   91 
   92   void sendRectHeader(const Rect *rect, INT32 encodingType);
   93   void sendRectHeader(UINT16 x, UINT16 y, UINT16 w, UINT16 h,
   94                       INT32 encodingType);
   95   void sendNewFBSize(Dimension *dim);
   96   void sendFbInClientDim(const EncodeOptions *encodeOptions,
   97                          const FrameBuffer *fb,
   98                          const Dimension *dim,
   99                          const PixelFormat *pf);
  100   void sendCursorShapeUpdate(const PixelFormat *fmt);
  101   void sendCursorPosUpdate();
  102   void sendCopyRect(const std::vector<Rect> *rects, const Point *source);
  103 
  104   void sendRectangles(Encoder *encoder,
  105                       const std::vector<Rect> *rects,
  106                       const FrameBuffer *frameBuffer,
  107                       const EncodeOptions *encodeOptions);
  108 
  109   void splitRegion(Encoder *encoder,
  110                    const Region *region,
  111                    std::vector<Rect> *rects,
  112                    const FrameBuffer *frameBuffer,
  113                    const EncodeOptions *encodeOptions);
  114 
  115   WindowsEvent m_newUpdatesEvent;
  116 
  117   UpdateRequestListener *m_updReqListener;
  118   Region m_requestedIncrReg;
  119   Region m_requestedFullReg;
  120   bool m_busy;
  121   LocalMutex m_reqRectLocMut;
  122 
  123   Rect m_viewPort;
  124   Dimension m_clientDim;
  125   Dimension m_lastViewPortDim;
  126   LocalMutex m_viewPortMut;
  127 
  128   UpdateKeeper *m_updateKeeper;
  129 
  130   FrameBufferAccessor m_fbAccessor;
  131 
  132   CursorShape m_cursorShape;
  133   LocalMutex m_curShapeLocMut;
  134 
  135   Point m_cursorPos;
  136   DateTime m_blockCurPosTime;
  137   LocalMutex m_curPosLocMut;
  138 
  139   EncodeOptions m_newEncodeOptions;
  140   LocalMutex m_newEncodeOptionsLocker;
  141 
  142   PixelFormat m_newPixelFormat;
  143   LocalMutex m_newPixelFormatLocker;
  144 
  145   bool m_setColorMapEntr;
  146 
  147   RfbOutputGate *m_output;
  148 
  149   PixelConverter m_pixelConverter;
  150 
  151   EncoderStore m_enbox;
  152 
  153   int m_id;
  154 };
  155 
  156 #endif