VirtualBox

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

最後變更 在這個檔案從28767是 28767,由 vboxsync 提交於 15 年 前

filemuncher run

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 4.3 KB
 
1/* $Id: FramebufferVNC.h 28767 2010-04-26 16:34:05Z vboxsync $ */
2/** @file
3 * VBox Remote Desktop Protocol - VNC server interface.
4 */
5
6/*
7 * Contributed by Ivo Smits <[email protected]>
8 *
9 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.alldomusa.eu.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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
20 * Clara, CA 95054 USA or visit http://www.sun.com if you need
21 * additional information or have any questions.
22 */
23
24#include <VBox/com/VirtualBox.h>
25
26#include <iprt/uuid.h>
27
28#include <VBox/com/com.h>
29#include <VBox/com/string.h>
30
31#include <iprt/initterm.h>
32#include <iprt/critsect.h>
33
34#include <rfb/rfb.h>
35#include <pthread.h>
36
37class VNCFB : VBOX_SCRIPTABLE_IMPL(IFramebuffer)
38{
39public:
40 VNCFB(ComPtr <IConsole> console, int port, char const *password);
41 virtual ~VNCFB();
42
43#ifndef VBOX_WITH_XPCOM
44 STDMETHOD_(ULONG, AddRef)() {
45 return ::InterlockedIncrement (&refcnt);
46 }
47 STDMETHOD_(ULONG, Release)() {
48 long cnt = ::InterlockedDecrement (&refcnt);
49 if (cnt == 0) delete this;
50 return cnt;
51 }
52#endif
53 VBOX_SCRIPTABLE_DISPATCH_IMPL(IFramebuffer)
54
55 NS_DECL_ISUPPORTS
56
57 // public methods only for internal purposes
58 HRESULT init ();
59
60 STDMETHOD(COMGETTER(Width))(ULONG *width);
61 STDMETHOD(COMGETTER(Height))(ULONG *height);
62 STDMETHOD(Lock)();
63 STDMETHOD(Unlock)();
64 STDMETHOD(COMGETTER(Address))(BYTE **address);
65 STDMETHOD(COMGETTER(BitsPerPixel))(ULONG *bitsPerPixel);
66 STDMETHOD(COMGETTER(BytesPerLine))(ULONG *bytesPerLine);
67 STDMETHOD(COMGETTER(PixelFormat)) (ULONG *pixelFormat);
68 STDMETHOD(COMGETTER(UsesGuestVRAM)) (BOOL *usesGuestVRAM);
69 STDMETHOD(COMGETTER(HeightReduction)) (ULONG *heightReduction);
70 STDMETHOD(COMGETTER(Overlay)) (IFramebufferOverlay **aOverlay);
71 STDMETHOD(COMGETTER(WinId)) (ULONG64 *winId);
72
73 STDMETHOD(NotifyUpdate)(ULONG x, ULONG y, ULONG w, ULONG h);
74 STDMETHOD(RequestResize)(ULONG aScreenId, ULONG pixelFormat, BYTE *vram,
75 ULONG bitsPerPixel, ULONG bytesPerLine,
76 ULONG w, ULONG h, BOOL *finished);
77 STDMETHOD(VideoModeSupported)(ULONG width, ULONG height, ULONG bpp, BOOL *supported);
78 STDMETHOD(GetVisibleRegion)(BYTE *rectangles, ULONG count, ULONG *countCopied);
79 STDMETHOD(SetVisibleRegion)(BYTE *rectangles, ULONG count);
80
81 STDMETHOD(ProcessVHWACommand)(BYTE *pCommand);
82
83private:
84 /** Guest framebuffer pixel format */
85 ULONG mPixelFormat;
86 /** Guest framebuffer color depth */
87 ULONG mBitsPerPixel;
88 /** Guest framebuffer line length */
89 ULONG mBytesPerLine;
90
91 //Our own framebuffer, in case we can't use the VRAM
92 uint8_t *mRGBBuffer;
93 //The source framebuffer (either our own mRGBBuffer or the guest VRAM)
94 uint8_t *mBufferAddress;
95 //VNC display framebuffer (RGB -> BGR converted)
96 uint8_t *mScreenBuffer;
97
98 int mVncPort;
99
100 ComPtr<IConsole> mConsole;
101 ComPtr<IKeyboard> mKeyboard;
102 ComPtr<IMouse> mMouse;
103
104 int kbdShiftState;
105 void kbdSetShift(int state);
106 void kbdPutCode(int code);
107 void kbdPutCode(int code, int down);
108 void kbdPutCodeShift(int shift, int code, int down);
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
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette