Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 1 | /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. |
Pierre Ossman | c754cce | 2011-11-14 15:44:11 +0000 | [diff] [blame] | 2 | * Copyright 2009-2011 Pierre Ossman for Cendio AB |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 3 | * |
| 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 Ossman | cbd1b2c | 2009-03-20 16:05:04 +0000 | [diff] [blame] | 19 | #include <stdio.h> |
| 20 | |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 21 | #include <rfb/Exception.h> |
| 22 | #include <rfb/CMsgHandler.h> |
Pierre Ossman | 49f8822 | 2009-03-20 13:02:50 +0000 | [diff] [blame] | 23 | #include <rfb/screenTypes.h> |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 24 | |
| 25 | using namespace rfb; |
| 26 | |
| 27 | CMsgHandler::CMsgHandler() |
| 28 | { |
| 29 | } |
| 30 | |
| 31 | CMsgHandler::~CMsgHandler() |
| 32 | { |
| 33 | } |
| 34 | |
| 35 | void CMsgHandler::setDesktopSize(int width, int height) |
| 36 | { |
| 37 | cp.width = width; |
| 38 | cp.height = height; |
| 39 | } |
| 40 | |
Pierre Ossman | 28c1d54 | 2015-03-03 16:27:44 +0100 | [diff] [blame] | 41 | void CMsgHandler::setExtendedDesktopSize(unsigned reason, unsigned result, |
Pierre Ossman | cbd1b2c | 2009-03-20 16:05:04 +0000 | [diff] [blame] | 42 | int width, int height, |
| 43 | const ScreenSet& layout) |
Pierre Ossman | 49f8822 | 2009-03-20 13:02:50 +0000 | [diff] [blame] | 44 | { |
Pierre Ossman | cbd1b2c | 2009-03-20 16:05:04 +0000 | [diff] [blame] | 45 | cp.supportsSetDesktopSize = true; |
| 46 | |
Pierre Ossman | 28c1d54 | 2015-03-03 16:27:44 +0100 | [diff] [blame] | 47 | if ((reason == reasonClient) && (result != resultSuccess)) |
Pierre Ossman | 49f8822 | 2009-03-20 13:02:50 +0000 | [diff] [blame] | 48 | return; |
| 49 | |
Pierre Ossman | cbd1b2c | 2009-03-20 16:05:04 +0000 | [diff] [blame] | 50 | if (!layout.validate(width, height)) |
| 51 | fprintf(stderr, "Server sent us an invalid screen layout\n"); |
| 52 | |
Pierre Ossman | 49f8822 | 2009-03-20 13:02:50 +0000 | [diff] [blame] | 53 | cp.width = width; |
| 54 | cp.height = height; |
Pierre Ossman | cbd1b2c | 2009-03-20 16:05:04 +0000 | [diff] [blame] | 55 | cp.screenLayout = layout; |
Pierre Ossman | 49f8822 | 2009-03-20 13:02:50 +0000 | [diff] [blame] | 56 | } |
| 57 | |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 58 | void CMsgHandler::setPixelFormat(const PixelFormat& pf) |
| 59 | { |
| 60 | cp.setPF(pf); |
| 61 | } |
| 62 | |
| 63 | void CMsgHandler::setName(const char* name) |
| 64 | { |
| 65 | cp.setName(name); |
| 66 | } |
| 67 | |
Pierre Ossman | c754cce | 2011-11-14 15:44:11 +0000 | [diff] [blame] | 68 | void CMsgHandler::fence(rdr::U32 flags, unsigned len, const char data[]) |
| 69 | { |
| 70 | cp.supportsFence = true; |
| 71 | } |
Pierre Ossman | c898d9a | 2011-11-14 16:22:23 +0000 | [diff] [blame] | 72 | |
| 73 | void CMsgHandler::endOfContinuousUpdates() |
| 74 | { |
| 75 | cp.supportsContinuousUpdates = true; |
| 76 | } |
Pierre Ossman | f3b0ade | 2015-02-04 14:11:11 +0100 | [diff] [blame] | 77 | |
Pierre Ossman | 5ae2821 | 2017-05-16 14:30:38 +0200 | [diff] [blame^] | 78 | void CMsgHandler::supportsQEMUKeyEvent() |
| 79 | { |
| 80 | cp.supportsQEMUKeyEvent = true; |
| 81 | } |
| 82 | |
Pierre Ossman | f3b0ade | 2015-02-04 14:11:11 +0100 | [diff] [blame] | 83 | void CMsgHandler::framebufferUpdateStart() |
| 84 | { |
| 85 | } |
| 86 | |
| 87 | void CMsgHandler::framebufferUpdateEnd() |
| 88 | { |
| 89 | } |
Pierre Ossman | 2fa63f8 | 2016-12-05 15:26:21 +0100 | [diff] [blame] | 90 | |
| 91 | void CMsgHandler::setLEDState(unsigned int state) |
| 92 | { |
| 93 | cp.setLEDState(state); |
| 94 | } |