blob: c009067ab448dc9fcf8d0abd48ffe91a11f026a1 [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 */
Pierre Ossmancbd1b2c2009-03-20 16:05:04 +000019#include <stdio.h>
20
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000021#include <rfb/Exception.h>
Pierre Ossmane9e7da92016-04-20 09:38:06 +020022#include <rfb/LogWriter.h>
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000023#include <rfb/CMsgHandler.h>
Pierre Ossman49f88222009-03-20 13:02:50 +000024#include <rfb/screenTypes.h>
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000025
Pierre Ossmane9e7da92016-04-20 09:38:06 +020026static rfb::LogWriter vlog("CMsgHandler");
27
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000028using namespace rfb;
29
30CMsgHandler::CMsgHandler()
31{
32}
33
34CMsgHandler::~CMsgHandler()
35{
36}
37
38void CMsgHandler::setDesktopSize(int width, int height)
39{
Pierre Ossmanb14a6bc2018-06-18 15:44:26 +020040 server.setDimensions(width, height);
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000041}
42
Pierre Ossman28c1d542015-03-03 16:27:44 +010043void CMsgHandler::setExtendedDesktopSize(unsigned reason, unsigned result,
Pierre Ossmancbd1b2c2009-03-20 16:05:04 +000044 int width, int height,
45 const ScreenSet& layout)
Pierre Ossman49f88222009-03-20 13:02:50 +000046{
Pierre Ossmanb14a6bc2018-06-18 15:44:26 +020047 server.supportsSetDesktopSize = true;
Pierre Ossmancbd1b2c2009-03-20 16:05:04 +000048
Pierre Ossman28c1d542015-03-03 16:27:44 +010049 if ((reason == reasonClient) && (result != resultSuccess))
Pierre Ossman49f88222009-03-20 13:02:50 +000050 return;
51
Pierre Ossmanb14a6bc2018-06-18 15:44:26 +020052 server.setDimensions(width, height, layout);
Pierre Ossman49f88222009-03-20 13:02:50 +000053}
54
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000055void CMsgHandler::setPixelFormat(const PixelFormat& pf)
56{
Pierre Ossmanb14a6bc2018-06-18 15:44:26 +020057 server.setPF(pf);
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000058}
59
60void CMsgHandler::setName(const char* name)
61{
Pierre Ossmanb14a6bc2018-06-18 15:44:26 +020062 server.setName(name);
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000063}
64
Pierre Ossmanc754cce2011-11-14 15:44:11 +000065void CMsgHandler::fence(rdr::U32 flags, unsigned len, const char data[])
66{
Pierre Ossmanb14a6bc2018-06-18 15:44:26 +020067 server.supportsFence = true;
Pierre Ossmanc754cce2011-11-14 15:44:11 +000068}
Pierre Ossmanc898d9a2011-11-14 16:22:23 +000069
70void CMsgHandler::endOfContinuousUpdates()
71{
Pierre Ossmanb14a6bc2018-06-18 15:44:26 +020072 server.supportsContinuousUpdates = true;
Pierre Ossmanc898d9a2011-11-14 16:22:23 +000073}
Pierre Ossmanf3b0ade2015-02-04 14:11:11 +010074
Pierre Ossman5ae28212017-05-16 14:30:38 +020075void CMsgHandler::supportsQEMUKeyEvent()
76{
Pierre Ossmanb14a6bc2018-06-18 15:44:26 +020077 server.supportsQEMUKeyEvent = true;
Pierre Ossman5ae28212017-05-16 14:30:38 +020078}
79
Pierre Ossmandd45b442018-10-31 17:08:59 +010080void CMsgHandler::serverInit(int width, int height,
81 const PixelFormat& pf,
82 const char* name)
83{
84 server.setDimensions(width, height);
85 server.setPF(pf);
86 server.setName(name);
87}
88
Pierre Ossmanf3b0ade2015-02-04 14:11:11 +010089void CMsgHandler::framebufferUpdateStart()
90{
91}
92
93void CMsgHandler::framebufferUpdateEnd()
94{
95}
Pierre Ossman2fa63f82016-12-05 15:26:21 +010096
97void CMsgHandler::setLEDState(unsigned int state)
98{
Pierre Ossmanb14a6bc2018-06-18 15:44:26 +020099 server.setLEDState(state);
Pierre Ossman2fa63f82016-12-05 15:26:21 +0100100}