blob: 661745984bb0f1f975667767dee63575d85c6ec9 [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
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +00003 *
4 * This is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This software is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this software; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17 * USA.
18 */
19//
20// CMsgWriter - class for writing RFB messages on the server side.
21//
22
23#ifndef __RFB_CMSGWRITER_H__
24#define __RFB_CMSGWRITER_H__
25
26#include <rfb/InputHandler.h>
Pierre Ossmane7a41d52009-03-23 16:48:35 +000027#include <rfb/ScreenSet.h>
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000028
29namespace rdr { class OutStream; }
30
31namespace rfb {
32
33 class PixelFormat;
34 class ConnParams;
35 struct Rect;
36
37 class CMsgWriter : public InputHandler {
38 public:
39 virtual ~CMsgWriter();
40
41 // CMsgWriter abstract interface methods
42 virtual void writeClientInit(bool shared)=0;
43 virtual void startMsg(int type)=0;
44 virtual void endMsg()=0;
45
Pierre Ossmane7a41d52009-03-23 16:48:35 +000046 virtual void writeSetDesktopSize(int width, int height,
47 const ScreenSet& layout)=0;
Pierre Ossmanc754cce2011-11-14 15:44:11 +000048 virtual void writeFence(rdr::U32 flags, unsigned len, const char data[])=0;
Pierre Ossmanc898d9a2011-11-14 16:22:23 +000049 virtual void writeEnableContinuousUpdates(bool enable,
50 int x, int y, int w, int h)=0;
Pierre Ossmane7a41d52009-03-23 16:48:35 +000051
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000052 // CMsgWriter implemented methods
53 virtual void writeSetPixelFormat(const PixelFormat& pf);
54 virtual void writeSetEncodings(int nEncodings, rdr::U32* encodings);
55 virtual void writeSetEncodings(int preferredEncoding, bool useCopyRect);
56 virtual void writeFramebufferUpdateRequest(const Rect& r,bool incremental);
57
58 // InputHandler implementation
59 virtual void keyEvent(rdr::U32 key, bool down);
60 virtual void pointerEvent(const Point& pos, int buttonMask);
Adam Tkacacf6c6b2009-02-13 12:42:05 +000061 virtual void clientCutText(const char* str, rdr::U32 len);
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000062
63 ConnParams* getConnParams() { return cp; }
64 rdr::OutStream* getOutStream() { return os; }
65
66 protected:
67 CMsgWriter(ConnParams* cp, rdr::OutStream* os);
68
69 ConnParams* cp;
70 rdr::OutStream* os;
71 };
72}
73#endif