blob: 4fe50414e7e0ba59cc7b6d75d5968613fe757926 [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>
22#include <rfb/CMsgHandler.h>
Pierre Ossman49f88222009-03-20 13:02:50 +000023#include <rfb/screenTypes.h>
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000024
25using namespace rfb;
26
27CMsgHandler::CMsgHandler()
28{
29}
30
31CMsgHandler::~CMsgHandler()
32{
33}
34
35void CMsgHandler::setDesktopSize(int width, int height)
36{
Pierre Ossmanb14a6bc2018-06-18 15:44:26 +020037 server.setDimensions(width, height);
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000038}
39
Pierre Ossman28c1d542015-03-03 16:27:44 +010040void CMsgHandler::setExtendedDesktopSize(unsigned reason, unsigned result,
Pierre Ossmancbd1b2c2009-03-20 16:05:04 +000041 int width, int height,
42 const ScreenSet& layout)
Pierre Ossman49f88222009-03-20 13:02:50 +000043{
Pierre Ossmanb14a6bc2018-06-18 15:44:26 +020044 server.supportsSetDesktopSize = true;
Pierre Ossmancbd1b2c2009-03-20 16:05:04 +000045
Pierre Ossman28c1d542015-03-03 16:27:44 +010046 if ((reason == reasonClient) && (result != resultSuccess))
Pierre Ossman49f88222009-03-20 13:02:50 +000047 return;
48
Pierre Ossmanb14a6bc2018-06-18 15:44:26 +020049 server.setDimensions(width, height, layout);
Pierre Ossman49f88222009-03-20 13:02:50 +000050}
51
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000052void CMsgHandler::setPixelFormat(const PixelFormat& pf)
53{
Pierre Ossmanb14a6bc2018-06-18 15:44:26 +020054 server.setPF(pf);
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000055}
56
57void CMsgHandler::setName(const char* name)
58{
Pierre Ossmanb14a6bc2018-06-18 15:44:26 +020059 server.setName(name);
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000060}
61
Pierre Ossmanc754cce2011-11-14 15:44:11 +000062void CMsgHandler::fence(rdr::U32 flags, unsigned len, const char data[])
63{
Pierre Ossmanb14a6bc2018-06-18 15:44:26 +020064 server.supportsFence = true;
Pierre Ossmanc754cce2011-11-14 15:44:11 +000065}
Pierre Ossmanc898d9a2011-11-14 16:22:23 +000066
67void CMsgHandler::endOfContinuousUpdates()
68{
Pierre Ossmanb14a6bc2018-06-18 15:44:26 +020069 server.supportsContinuousUpdates = true;
Pierre Ossmanc898d9a2011-11-14 16:22:23 +000070}
Pierre Ossmanf3b0ade2015-02-04 14:11:11 +010071
Pierre Ossman5ae28212017-05-16 14:30:38 +020072void CMsgHandler::supportsQEMUKeyEvent()
73{
Pierre Ossmanb14a6bc2018-06-18 15:44:26 +020074 server.supportsQEMUKeyEvent = true;
Pierre Ossman5ae28212017-05-16 14:30:38 +020075}
76
Pierre Ossmandd45b442018-10-31 17:08:59 +010077void CMsgHandler::serverInit(int width, int height,
78 const PixelFormat& pf,
79 const char* name)
80{
81 server.setDimensions(width, height);
82 server.setPF(pf);
83 server.setName(name);
84}
85
Pierre Ossmanf3b0ade2015-02-04 14:11:11 +010086void CMsgHandler::framebufferUpdateStart()
87{
88}
89
90void CMsgHandler::framebufferUpdateEnd()
91{
92}
Pierre Ossman2fa63f82016-12-05 15:26:21 +010093
94void CMsgHandler::setLEDState(unsigned int state)
95{
Pierre Ossmanb14a6bc2018-06-18 15:44:26 +020096 server.setLEDState(state);
Pierre Ossman2fa63f82016-12-05 15:26:21 +010097}