blob: effdaabff0fd370af744298278ee5d53edfae866 [file] [log] [blame]
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +00001/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
Pierre Ossmanc754cce2011-11-14 15:44:11 +00002 * Copyright 2009-2011 Pierre Ossman for Cendio AB
DRC33c15e32011-11-03 18:49:21 +00003 * Copyright (C) 2011 D. R. Commander. All Rights Reserved.
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +00004 *
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>
Pierre Ossmanb14a6bc2018-06-18 15:44:26 +020029#include <rfb/ServerParams.h>
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000030#include <rfb/Rect.h>
Pierre Ossmancbd1b2c2009-03-20 16:05:04 +000031#include <rfb/ScreenSet.h>
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000032
33namespace rdr { class InStream; }
34
35namespace 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
Pierre Ossmandd45b442018-10-31 17:08:59 +010044 // the setDesktopSize(), setExtendedDesktopSize(), setPixelFormat(),
45 // setName() and serverInit() methods, a derived class should call on to
46 // CMsgHandler's methods to set the members of "server" appropriately.
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000047
48 virtual void setDesktopSize(int w, int h);
Pierre Ossman28c1d542015-03-03 16:27:44 +010049 virtual void setExtendedDesktopSize(unsigned reason, unsigned result,
Pierre Ossmancbd1b2c2009-03-20 16:05:04 +000050 int w, int h,
51 const ScreenSet& layout);
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000052 virtual void setCursor(int width, int height, const Point& hotspot,
Pierre Ossman6a1a0d02017-02-19 15:48:17 +010053 const rdr::U8* data) = 0;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000054 virtual void setPixelFormat(const PixelFormat& pf);
55 virtual void setName(const char* name);
Pierre Ossmanc754cce2011-11-14 15:44:11 +000056 virtual void fence(rdr::U32 flags, unsigned len, const char data[]);
Pierre Ossmanc898d9a2011-11-14 16:22:23 +000057 virtual void endOfContinuousUpdates();
Pierre Ossman5ae28212017-05-16 14:30:38 +020058 virtual void supportsQEMUKeyEvent();
Pierre Ossmandd45b442018-10-31 17:08:59 +010059 virtual void serverInit(int width, int height,
60 const PixelFormat& pf,
61 const char* name) = 0;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000062
Pierre Ossmana4c0aac2017-02-19 15:50:29 +010063 virtual void readAndDecodeRect(const Rect& r, int encoding,
64 ModifiablePixelBuffer* pb) = 0;
65
Pierre Ossmanf3b0ade2015-02-04 14:11:11 +010066 virtual void framebufferUpdateStart();
67 virtual void framebufferUpdateEnd();
Pierre Ossmanfdba3fe2014-01-31 13:12:18 +010068 virtual void dataRect(const Rect& r, int encoding) = 0;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000069
70 virtual void setColourMapEntries(int firstColour, int nColours,
Adam Tkacc184d952009-06-16 10:50:06 +000071 rdr::U16* rgbs) = 0;
72 virtual void bell() = 0;
73 virtual void serverCutText(const char* str, rdr::U32 len) = 0;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000074
Pierre Ossman2fa63f82016-12-05 15:26:21 +010075 virtual void setLEDState(unsigned int state);
76
Pierre Ossmanb14a6bc2018-06-18 15:44:26 +020077 ServerParams server;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000078 };
79}
80#endif