1 /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. 2 * Copyright 2009-2019 Pierre Ossman for Cendio AB 3 * Copyright (C) 2011 D. R. Commander. All Rights Reserved. 4 * 5 * This is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This software is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this software; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 18 * USA. 19 */ 20 // 21 // CMsgHandler - class to handle incoming messages on the client side. 22 // 23 24 #ifndef __RFB_CMSGHANDLER_H__ 25 #define __RFB_CMSGHANDLER_H__ 26 27 #include <rdr/types.h> 28 #include <rfb/Pixel.h> 29 #include <rfb/ServerParams.h> 30 #include <rfb/Rect.h> 31 #include <rfb/ScreenSet.h> 32 33 namespace rdr { class InStream; } 34 35 namespace rfb { 36 37 class CMsgHandler { 38 public: 39 CMsgHandler(); 40 virtual ~CMsgHandler(); 41 42 // The following methods are called as corresponding messages are read. A 43 // derived class should override these methods as desired. Note that for 44 // the setDesktopSize(), setExtendedDesktopSize(), setPixelFormat(), 45 // setName(), serverInit() and clipboardCaps methods, a derived class 46 // should call on to CMsgHandler's methods to set the members of "server" 47 // appropriately. 48 49 virtual void setDesktopSize(int w, int h); 50 virtual void setExtendedDesktopSize(unsigned reason, unsigned result, 51 int w, int h, 52 const ScreenSet& layout); 53 virtual void setCursor(int width, int height, const Point& hotspot, 54 const rdr::U8* data) = 0; 55 virtual void setCursorPos(const Point& pos) = 0; 56 virtual void setPixelFormat(const PixelFormat& pf); 57 virtual void setName(const char* name); 58 virtual void fence(rdr::U32 flags, unsigned len, const char data[]); 59 virtual void endOfContinuousUpdates(); 60 virtual void supportsQEMUKeyEvent(); 61 virtual void serverInit(int width, int height, 62 const PixelFormat& pf, 63 const char* name) = 0; 64 65 virtual bool readAndDecodeRect(const Rect& r, int encoding, 66 ModifiablePixelBuffer* pb) = 0; 67 68 virtual void framebufferUpdateStart(); 69 virtual void framebufferUpdateEnd(); 70 virtual bool dataRect(const Rect& r, int encoding) = 0; 71 72 virtual void setColourMapEntries(int firstColour, int nColours, 73 rdr::U16* rgbs) = 0; 74 virtual void bell() = 0; 75 virtual void serverCutText(const char* str) = 0; 76 77 virtual void setLEDState(unsigned int state); 78 79 virtual void handleClipboardCaps(rdr::U32 flags, 80 const rdr::U32* lengths); 81 virtual void handleClipboardRequest(rdr::U32 flags); 82 virtual void handleClipboardPeek(rdr::U32 flags); 83 virtual void handleClipboardNotify(rdr::U32 flags); 84 virtual void handleClipboardProvide(rdr::U32 flags, 85 const size_t* lengths, 86 const rdr::U8* const* data); 87 88 ServerParams server; 89 }; 90 } 91 #endif 92