VirtualBox

source: vbox/trunk/src/VBox/Frontends/VBoxHeadless/FramebufferVNC.h@ 35273

Last change on this file since 35273 was 31698, checked in by vboxsync, 14 years ago

Main, frontends: unsigned long long -> long long

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.2 KB
Line 
1/* $Id: FramebufferVNC.h 31698 2010-08-16 15:00:05Z vboxsync $ */
2/** @file
3 * VBox Remote Desktop Protocol - VNC server interface.
4 */
5
6/*
7 * Contributed by Ivo Smits <Ivo@UFO-Net.nl>
8 *
9 * Copyright (C) 2006-2007 Oracle Corporation
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.virtualbox.org. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the GNU
14 * General Public License (GPL) as published by the Free Software
15 * Foundation, in version 2 as it comes in the "COPYING" file of the
16 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 */
19
20#include <VBox/com/VirtualBox.h>
21
22#include <iprt/uuid.h>
23
24#include <VBox/com/com.h>
25#include <VBox/com/string.h>
26
27#include <iprt/initterm.h>
28#include <iprt/critsect.h>
29
30#include <rfb/rfb.h>
31#include <pthread.h>
32
33class VNCFB : VBOX_SCRIPTABLE_IMPL(IFramebuffer)
34{
35public:
36 VNCFB(ComPtr <IConsole> console, int port, char const *password);
37 virtual ~VNCFB();
38
39#ifndef VBOX_WITH_XPCOM
40 STDMETHOD_(ULONG, AddRef)() {
41 return ::InterlockedIncrement (&refcnt);
42 }
43 STDMETHOD_(ULONG, Release)() {
44 long cnt = ::InterlockedDecrement (&refcnt);
45 if (cnt == 0)
46 delete this;
47 return cnt;
48 }
49#endif
50 VBOX_SCRIPTABLE_DISPATCH_IMPL(IFramebuffer)
51
52 NS_DECL_ISUPPORTS
53
54 // public methods only for internal purposes
55 HRESULT init (const char *pszName);
56 void enableAbsMouse(bool fEnable);
57
58 STDMETHOD(COMGETTER(Width))(ULONG *width);
59 STDMETHOD(COMGETTER(Height))(ULONG *height);
60 STDMETHOD(Lock)();
61 STDMETHOD(Unlock)();
62 STDMETHOD(COMGETTER(Address))(BYTE **address);
63 STDMETHOD(COMGETTER(BitsPerPixel))(ULONG *bitsPerPixel);
64 STDMETHOD(COMGETTER(BytesPerLine))(ULONG *bytesPerLine);
65 STDMETHOD(COMGETTER(PixelFormat)) (ULONG *pixelFormat);
66 STDMETHOD(COMGETTER(UsesGuestVRAM)) (BOOL *usesGuestVRAM);
67 STDMETHOD(COMGETTER(HeightReduction)) (ULONG *heightReduction);
68 STDMETHOD(COMGETTER(Overlay)) (IFramebufferOverlay **aOverlay);
69 STDMETHOD(COMGETTER(WinId)) (LONG64 *winId);
70
71 STDMETHOD(NotifyUpdate)(ULONG x, ULONG y, ULONG w, ULONG h);
72 STDMETHOD(RequestResize)(ULONG aScreenId, ULONG pixelFormat, BYTE *vram,
73 ULONG bitsPerPixel, ULONG bytesPerLine,
74 ULONG w, ULONG h, BOOL *finished);
75 STDMETHOD(VideoModeSupported)(ULONG width, ULONG height, ULONG bpp, BOOL *supported);
76 STDMETHOD(GetVisibleRegion)(BYTE *rectangles, ULONG count, ULONG *countCopied);
77 STDMETHOD(SetVisibleRegion)(BYTE *rectangles, ULONG count);
78
79 STDMETHOD(ProcessVHWACommand)(BYTE *pCommand);
80
81private:
82 /** Guest framebuffer pixel format */
83 ULONG mPixelFormat;
84 /** Guest framebuffer color depth */
85 ULONG mBitsPerPixel;
86 /** Guest framebuffer line length */
87 ULONG mBytesPerLine;
88
89 //Our own framebuffer, in case we can't use the VRAM
90 uint8_t *mRGBBuffer;
91 //The source framebuffer (either our own mRGBBuffer or the guest VRAM)
92 uint8_t *mBufferAddress;
93 //VNC display framebuffer (RGB -> BGR converted)
94 uint8_t *mScreenBuffer;
95
96 int mVncPort;
97
98 ComPtr<IConsole> mConsole;
99 ComPtr<IKeyboard> mKeyboard;
100 ComPtr<IMouse> mMouse;
101
102 int kbdShiftState;
103 void kbdSetShift(int state);
104 void kbdPutCode(int code);
105 void kbdPutCode(int code, int down);
106 void kbdPutCodeShift(int shift, int code, int down);
107
108 bool fAbsMouseEnabled;
109
110 ULONG mWidth, mHeight;
111
112 RTCRITSECT mCritSect;
113
114 rfbScreenInfoPtr vncServer;
115 RTTHREAD mVncThread;
116 static DECLCALLBACK(int) vncThreadFn(RTTHREAD hThreadSelf, void *pvUser);
117 /** The password that was passed to the constructor. NULL if no
118 * authentication required. */
119 char const *mVncPassword;
120
121 static void vncKeyboardEvent(rfbBool down, rfbKeySym keySym, rfbClientPtr cl);
122 static void vncMouseEvent(int buttonMask, int x, int y, rfbClientPtr cl);
123 static void vncReleaseKeysEvent(rfbClientPtr cl);
124
125 void handleVncKeyboardEvent(int down, int keySym);
126 void handleVncMouseEvent(int buttonMask, int x, int y);
127 void handleVncKeyboardReleaseEvent();
128
129 int mouseX, mouseY;
130
131#ifndef VBOX_WITH_XPCOM
132 long refcnt;
133#endif
134};
135
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use