Constantin Kaplinsky | b30ae7f | 2006-05-25 05:04:46 +0000 | [diff] [blame] | 1 | /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. |
Pierre Ossman | 49f8822 | 2009-03-20 13:02:50 +0000 | [diff] [blame] | 2 | * Copyright 2009 Pierre Ossman for Cendio AB |
Constantin Kaplinsky | b30ae7f | 2006-05-25 05:04:46 +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 | */ |
| 19 | // |
| 20 | // CConn represents a client connection to a VNC server. |
| 21 | // |
| 22 | |
| 23 | #ifndef __CCONN_H__ |
| 24 | #define __CCONN_H__ |
| 25 | |
| 26 | #include <rfb/CConnection.h> |
| 27 | #include <rfb/Exception.h> |
| 28 | #include <rfb/UserPasswdGetter.h> |
| 29 | #include <rdr/FdInStream.h> |
| 30 | #include <list> |
| 31 | |
| 32 | #include "TXWindow.h" |
| 33 | #include "AboutDialog.h" |
| 34 | #include "InfoDialog.h" |
| 35 | #include "TXMenu.h" |
| 36 | #include "OptionsDialog.h" |
| 37 | |
| 38 | class TXWindow; |
| 39 | class TXViewport; |
| 40 | class DesktopWindow; |
| 41 | namespace network { class Socket; } |
| 42 | |
| 43 | class CConn : public rfb::CConnection, public rfb::UserPasswdGetter, |
| 44 | public TXDeleteWindowCallback, |
| 45 | public rdr::FdInStreamBlockCallback, |
| 46 | public TXMenuCallback , public OptionsDialogCallback, |
| 47 | public TXEventHandler |
| 48 | { |
| 49 | public: |
| 50 | |
| 51 | CConn(Display* dpy_, int argc_, char** argv_, network::Socket* sock_, |
| 52 | char* vncServerName, bool reverse=false); |
| 53 | ~CConn(); |
| 54 | |
| 55 | // TXDeleteWindowCallback methods |
| 56 | void deleteWindow(TXWindow* w); |
| 57 | |
| 58 | // FdInStreamBlockCallback methods |
| 59 | void blockCallback(); |
| 60 | |
| 61 | // UserPasswdGetter methods |
| 62 | virtual void getUserPasswd(char** user, char** password); |
| 63 | |
| 64 | // TXMenuCallback methods |
| 65 | void menuSelect(long id, TXMenu* m); |
| 66 | |
| 67 | // OptionsDialogCallback methods |
| 68 | virtual void setOptions(); |
| 69 | virtual void getOptions(); |
| 70 | |
| 71 | // TXEventHandler callback method |
| 72 | virtual void handleEvent(TXWindow* w, XEvent* ev); |
| 73 | |
| 74 | // CConnection callback methods |
| 75 | rfb::CSecurity* getCSecurity(int secType); |
| 76 | void serverInit(); |
| 77 | void setDesktopSize(int w, int h); |
Pierre Ossman | cbd1b2c | 2009-03-20 16:05:04 +0000 | [diff] [blame] | 78 | void setExtendedDesktopSize(int reason, int result, int w, int h, |
| 79 | const rfb::ScreenSet& layout); |
Peter Åstrand | c39e078 | 2009-01-15 12:21:42 +0000 | [diff] [blame] | 80 | void setName(const char* name); |
Constantin Kaplinsky | b30ae7f | 2006-05-25 05:04:46 +0000 | [diff] [blame] | 81 | void setColourMapEntries(int firstColour, int nColours, rdr::U16* rgbs); |
| 82 | void bell(); |
| 83 | void serverCutText(const char* str, int len); |
| 84 | void framebufferUpdateEnd(); |
| 85 | void beginRect(const rfb::Rect& r, unsigned int encoding); |
| 86 | void endRect(const rfb::Rect& r, unsigned int encoding); |
| 87 | void fillRect(const rfb::Rect& r, rfb::Pixel p); |
| 88 | void imageRect(const rfb::Rect& r, void* p); |
| 89 | void copyRect(const rfb::Rect& r, int sx, int sy); |
| 90 | void setCursor(int width, int height, const rfb::Point& hotspot, |
| 91 | void* data, void* mask); |
| 92 | |
| 93 | private: |
| 94 | |
Pierre Ossman | 49f8822 | 2009-03-20 13:02:50 +0000 | [diff] [blame] | 95 | void resizeFramebuffer(); |
Constantin Kaplinsky | b30ae7f | 2006-05-25 05:04:46 +0000 | [diff] [blame] | 96 | void recreateViewport(); |
| 97 | void reconfigureViewport(); |
| 98 | void initMenu(); |
| 99 | void showMenu(int x, int y); |
| 100 | void autoSelectFormatAndEncoding(); |
| 101 | void checkEncodings(); |
| 102 | void requestNewUpdate(); |
| 103 | |
| 104 | Display* dpy; |
| 105 | int argc; |
| 106 | char** argv; |
| 107 | char* serverHost; |
| 108 | int serverPort; |
| 109 | network::Socket* sock; |
| 110 | rfb::PixelFormat serverPF; |
| 111 | TXViewport* viewport; |
| 112 | DesktopWindow* desktop; |
| 113 | TXEventHandler* desktopEventHandler; |
| 114 | rfb::PixelFormat fullColourPF; |
| 115 | std::list<rfb::Rect> debugRects; |
| 116 | unsigned int currentEncoding, lastServerEncoding; |
| 117 | bool fullColour; |
| 118 | bool autoSelect; |
| 119 | bool shared; |
| 120 | bool formatChange; |
| 121 | bool encodingChange; |
| 122 | bool sameMachine; |
| 123 | bool fullScreen; |
| 124 | bool ctrlDown; |
| 125 | bool altDown; |
| 126 | KeySym menuKeysym; |
| 127 | TXMenu menu; |
| 128 | TXEventHandler* menuEventHandler; |
| 129 | OptionsDialog options; |
| 130 | AboutDialog about; |
| 131 | InfoDialog info; |
| 132 | bool reverseConnection; |
| 133 | }; |
| 134 | |
| 135 | #endif |