blob: 35f1f94b5dfc2c167823f738bbedcd1c0af05818 [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#ifndef __RFB_SMSGWRITERV3_H__
20#define __RFB_SMSGWRITERV3_H__
21
Pierre Ossmanc5e25602009-03-20 12:59:05 +000022#include <list>
Pierre Ossman04e62db2009-03-23 16:57:07 +000023#include <utility>
Pierre Ossmanc5e25602009-03-20 12:59:05 +000024
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000025#include <rfb/SMsgWriter.h>
26
27namespace rdr { class MemOutStream; }
28
29namespace rfb {
30 class SMsgWriterV3 : public SMsgWriter {
31 public:
32 SMsgWriterV3(ConnParams* cp, rdr::OutStream* os);
33 virtual ~SMsgWriterV3();
34
35 virtual void writeServerInit();
36 virtual void startMsg(int type);
37 virtual void endMsg();
Pierre Ossmanc754cce2011-11-14 15:44:11 +000038 virtual void writeFence(rdr::U32 flags, unsigned len, const char data[]);
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000039 virtual bool writeSetDesktopSize();
Pierre Ossman04e62db2009-03-23 16:57:07 +000040 virtual bool writeExtendedDesktopSize();
41 virtual bool writeExtendedDesktopSize(rdr::U16 reason, rdr::U16 result,
42 int fb_width, int fb_height,
43 const ScreenSet& layout);
Peter Åstrandc39e0782009-01-15 12:21:42 +000044 virtual bool writeSetDesktopName();
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000045 virtual void cursorChange(WriteSetCursorCallback* cb);
46 virtual void writeSetCursor(int width, int height, const Point& hotspot,
47 void* data, void* mask);
48 virtual void writeSetXCursor(int width, int height, int hotspotX,
49 int hotspotY, void* data, void* mask);
Pierre Ossmane9962f72009-04-23 12:31:42 +000050 virtual bool needFakeUpdate();
51 virtual bool needNoDataUpdate();
52 virtual void writeNoDataUpdate();
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000053 virtual void writeFramebufferUpdateStart(int nRects);
54 virtual void writeFramebufferUpdateStart();
55 virtual void writeFramebufferUpdateEnd();
Peter Åstrand98fe98c2010-02-10 07:43:02 +000056 virtual void startRect(const Rect& r, int encoding);
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000057 virtual void endRect();
58
Pierre Ossmane9962f72009-04-23 12:31:42 +000059 protected:
60 virtual void writePseudoRects();
61 virtual void writeNoDataRects();
62
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000063 private:
64 rdr::MemOutStream* updateOS;
65 rdr::OutStream* realOS;
66 int nRectsInUpdate;
67 int nRectsInHeader;
68 WriteSetCursorCallback* wsccb;
69 bool needSetDesktopSize;
Pierre Ossmanc5e25602009-03-20 12:59:05 +000070 bool needExtendedDesktopSize;
Peter Åstrandc39e0782009-01-15 12:21:42 +000071 bool needSetDesktopName;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000072 bool needLastRect;
Pierre Ossman04e62db2009-03-23 16:57:07 +000073
74 typedef struct {
75 rdr::U16 reason, result;
76 int fb_width, fb_height;
77 ScreenSet layout;
78 } ExtendedDesktopSizeMsg;
79 std::list<ExtendedDesktopSizeMsg> extendedDesktopSizeMsgs;
80
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000081 };
82}
83#endif