Changeset 30200 in vbox for trunk/src/VBox/Frontends/VBoxHeadless
- Timestamp:
- Jun 15, 2010 2:18:05 PM (14 years ago)
- Location:
- trunk/src/VBox/Frontends/VBoxHeadless
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxHeadless/FramebufferVNC.cpp
r28800 r30200 59 59 } 60 60 61 62 VNCFB::~VNCFB(){61 VNCFB::~VNCFB() 62 { 63 63 LogFlow(("Destroying VNCFB object %p\n", this)); 64 64 RTCritSectDelete(&mCritSect); 65 if (vncServer) { 66 if (vncServer->authPasswdData) { 67 char **papszPassword = (char **)vncServer->authPasswdData; 68 vncServer->authPasswdData = NULL; 69 RTMemFree(papszPassword[0]); 70 RTMemFree(papszPassword); 71 } 65 if (vncServer) 66 { 67 RTStrFree((char*)vncServer->desktopName); 68 if (vncServer->authPasswdData) 69 { 70 char **papszPassword = (char **)vncServer->authPasswdData; 71 vncServer->authPasswdData = NULL; 72 RTMemFree(papszPassword[0]); 73 RTMemFree(papszPassword); 74 } 72 75 rfbScreenCleanup(vncServer); 73 76 } … … 78 81 } 79 82 80 HRESULT VNCFB::init() { 83 HRESULT VNCFB::init(const char *pszName) 84 { 81 85 LogFlow(("Initialising VNCFB object %p\n", this)); 82 86 int rc = RTCritSectInit(&mCritSect); … … 85 89 vncServer = rfbGetScreen(0, NULL, mWidth, mHeight, 8, 3, 1); 86 90 vncServer->screenData = (void*)this; 87 if (mVncPort) vncServer->port = mVncPort; 88 vncServer->desktopName = "VirtualBox"; 89 90 if (mVncPassword) { 91 char **papszPasswords = (char **)RTMemAlloc(2 * sizeof(char **)); 91 if (mVncPort) 92 vncServer->port = mVncPort; 93 char *pszDesktopName; 94 rc = RTStrAPrintf(&pszDesktopName, "%s - VirtualBox", pszName); 95 if (RT_SUCCESS(rc)) 96 vncServer->desktopName = (const char*)pszDesktopName; 97 else 98 vncServer->desktopName = "VirtualBox"; 99 if (mVncPassword) 100 { 101 char **papszPasswords = (char **)RTMemAlloc(2 * sizeof(char **)); 92 102 papszPasswords[0] = RTStrDup(mVncPassword); 93 103 papszPasswords[1] = NULL; 94 vncServer->authPasswdData = papszPasswords;104 vncServer->authPasswdData = papszPasswords; 95 105 vncServer->passwordCheck = rfbCheckPasswordByList; //Password list based authentication function 96 } else {97 vncServer->authPasswdData = NULL;98 }106 } 107 else 108 vncServer->authPasswdData = NULL; 99 109 100 110 rfbInitServer(vncServer); … … 114 124 } 115 125 126 void VNCFB::enableAbsMouse(bool fEnable) 127 { 128 fAbsMouseEnabled = fEnable; 129 } 130 116 131 DECLCALLBACK(int) VNCFB::vncThreadFn(RTTHREAD hThreadSelf, void *pvUser) 117 132 { … … 120 135 } 121 136 122 void VNCFB::vncMouseEvent(int buttonMask, int x, int y, rfbClientPtr cl) { 137 void VNCFB::vncMouseEvent(int buttonMask, int x, int y, rfbClientPtr cl) 138 { 123 139 ((VNCFB*)(cl->screen->screenData))->handleVncMouseEvent(buttonMask, x, y); 124 140 rfbDefaultPtrAddEvent(buttonMask, x, y, cl); 125 141 } 126 142 127 void VNCFB::handleVncMouseEvent(int buttonMask, int x, int y) { 143 void VNCFB::handleVncMouseEvent(int buttonMask, int x, int y) 144 { 128 145 //RTPrintf("VNC mouse: button=%d x=%d y=%d\n", buttonMask, x, y); 129 if (!mMouse) { 146 if (!mMouse) 147 { 130 148 this->mConsole->COMGETTER(Mouse)(mMouse.asOutParam()); 131 if (!mMouse) { 149 if (!mMouse) 150 { 132 151 RTPrintf("Warning: could not get mouse object!\n"); 133 152 return; … … 135 154 } 136 155 int dz = 0, buttons = 0; 137 if (buttonMask & 16) dz = 1; else if (buttonMask & 8) dz = -1; 138 if (buttonMask & 1) buttons |= 1; 139 if (buttonMask & 2) buttons |= 4; 140 if (buttonMask & 4) buttons |= 2; 141 mMouse->PutMouseEvent(x - mouseX, y - mouseY, dz, 0, buttons); 142 //mMouse->PutMouseEventAbsolute(x + 1, y + 1, dz, 0, buttonMask); 156 if (buttonMask & 16) 157 dz = 1; 158 else if (buttonMask & 8) 159 dz = -1; 160 if (buttonMask & 1) 161 buttons |= 1; 162 if (buttonMask & 2) 163 buttons |= 4; 164 if (buttonMask & 4) 165 buttons |= 2; 166 if (fAbsMouseEnabled) 167 mMouse->PutMouseEventAbsolute(x, y, dz, 0, buttons); 168 else 169 mMouse->PutMouseEvent(x - mouseX, y - mouseY, dz, 0, buttons); 143 170 mouseX = x; 144 171 mouseY = y; 145 172 } 146 173 147 void VNCFB::kbdPutCode(int code) { 174 void VNCFB::kbdPutCode(int code) 175 { 148 176 mKeyboard->PutScancode(code); 149 177 } 150 void VNCFB::kbdSetShift(int state) { 151 if (state && !kbdShiftState) { 178 179 void VNCFB::kbdSetShift(int state) 180 { 181 if (state && !kbdShiftState) 182 { 152 183 kbdPutCode(0x2a, 1); 153 184 kbdShiftState = 1; 154 } else if (!state && kbdShiftState) { 185 } 186 else if (!state && kbdShiftState) 187 { 155 188 kbdPutCode(0x2a, 0); 156 189 kbdShiftState = 0; 157 190 } 158 191 } 159 void VNCFB::kbdPutCode(int code, int down) { 160 if (code & 0xff00) kbdPutCode((code >> 8) & 0xff); 192 void VNCFB::kbdPutCode(int code, int down) 193 { 194 if (code & 0xff00) 195 kbdPutCode((code >> 8) & 0xff); 161 196 kbdPutCode((code & 0xff) | (down ? 0 : 0x80)); 162 197 } 163 void VNCFB::kbdPutCodeShift(int shift, int code, int down) { 164 if (shift != kbdShiftState) kbdPutCode(0x2a, shift); 198 199 void VNCFB::kbdPutCodeShift(int shift, int code, int down) 200 { 201 if (shift != kbdShiftState) 202 kbdPutCode(0x2a, shift); 165 203 kbdPutCode(code, down); 166 if (shift != kbdShiftState) kbdPutCode(0x2a, kbdShiftState); 204 if (shift != kbdShiftState) 205 kbdPutCode(0x2a, kbdShiftState); 167 206 } 168 207 … … 171 210 * Now we're using one lookup table for the lower X11 key codes (ASCII characters) 172 211 * and a switch() block to handle some special keys. */ 173 void VNCFB::handleVncKeyboardEvent(int down, int keycode) { 212 void VNCFB::handleVncKeyboardEvent(int down, int keycode) 213 { 174 214 //RTPrintf("VNC keyboard: down=%d code=%d -> ", down, keycode); 175 if (mKeyboard == NULL) { 215 if (mKeyboard == NULL) 216 { 176 217 this->mConsole->COMGETTER(Keyboard)(mKeyboard.asOutParam()); 177 if (!mKeyboard) { 218 if (!mKeyboard) 219 { 178 220 RTPrintf("Warning: could not get keyboard object!\n"); 179 221 return; … … 188 230 * This is necessary because the VNC protocol sends a shift key sequence, but also 189 231 * sends the 'shifted' version of the characters. */ 190 static int codes_low[] = { //Conversion table for VNC key code range 32-127 232 static int codes_low[] = 233 { 234 //Conversion table for VNC key code range 32-127 191 235 0x0239, 0x0102, 0x0128, 0x0104, 0x0105, 0x0106, 0x0108, 0x0028, 0x010a, 0x010b, 0x0109, 0x010d, 0x0029, 0x000c, 0x0034, 0x0035, //space, !"#$%&'()*+`-./ 192 236 0x0b, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, //0123456789 … … 198 242 }; 199 243 int shift = -1, code = -1; 200 if (keycode < 32) { //ASCII control codes.. unused.. 201 } else if (keycode < 127) { //DEL is in high area 244 if (keycode < 32) 245 { 246 //ASCII control codes.. unused.. 247 } 248 else if (keycode < 127) 249 { 250 //DEL is in high area 202 251 code = codes_low[keycode - 32]; 203 shift = (code >> 8) & 0x03; if (shift == 0x02 || code & 0xe000) shift = -1; 252 shift = (code >> 8) & 0x03; 253 if (shift == 0x02 || code & 0xe000) 254 shift = -1; 204 255 code = code & 0xe0ff; 205 } else if ((keycode & 0xFF00) != 0xFF00) { 206 } else { 207 switch(keycode) { 256 } 257 else if ((keycode & 0xFF00) != 0xFF00) 258 { 259 } 260 else 261 { 262 switch(keycode) 263 { 208 264 /*Numpad keys - these have to be implemented yet 209 265 Todo: numpad arrows, home, pageup, pagedown, end, insert, delete … … 273 329 } 274 330 //RTPrintf("down=%d shift=%d code=%d\n", down, shift, code); 275 if (shift != -1 && code != -1) { 331 if (shift != -1 && code != -1) 332 { 276 333 kbdPutCodeShift(shift, code, down); 277 } else if (shift != -1) { 334 } 335 else if (shift != -1) 336 { 278 337 kbdSetShift(shift); 279 } else if (code != -1) { 338 } 339 else if (code != -1) 340 { 280 341 kbdPutCode(code, down); 281 342 } 282 343 } 283 void VNCFB::handleVncKeyboardReleaseEvent() { 344 void VNCFB::handleVncKeyboardReleaseEvent() 345 { 284 346 kbdSetShift(0); 285 347 kbdPutCode(0x1d, 0); //Left ctrl … … 289 351 } 290 352 291 void VNCFB::vncKeyboardEvent(rfbBool down, rfbKeySym keySym, rfbClientPtr cl) { 353 void VNCFB::vncKeyboardEvent(rfbBool down, rfbKeySym keySym, rfbClientPtr cl) 354 { 292 355 ((VNCFB*)(cl->screen->screenData))->handleVncKeyboardEvent(down, keySym); 293 356 } 294 void VNCFB::vncReleaseKeysEvent(rfbClientPtr cl) { //Release modifier keys 357 358 void VNCFB::vncReleaseKeysEvent(rfbClientPtr cl) 359 { 360 //Release modifier keys 295 361 ((VNCFB*)(cl->screen->screenData))->handleVncKeyboardReleaseEvent(); 296 362 } … … 327 393 BYTE *vram, ULONG bitsPerPixel, 328 394 ULONG bytesPerLine, 329 ULONG w, ULONG h, BOOL *finished) { 395 ULONG w, ULONG h, BOOL *finished) 396 { 330 397 NOREF(aScreenId); 331 if (!finished) return E_POINTER; 398 if (!finished) 399 return E_POINTER; 332 400 333 401 /* For now, we are doing things synchronously */ 334 402 *finished = true; 335 403 336 if (mRGBBuffer) RTMemFree(mRGBBuffer); 404 if (mRGBBuffer) 405 RTMemFree(mRGBBuffer); 337 406 338 407 mWidth = w; 339 408 mHeight = h; 340 409 341 if (pixelFormat == FramebufferPixelFormat_FOURCC_RGB && bitsPerPixel == 32) { 410 if (pixelFormat == FramebufferPixelFormat_FOURCC_RGB && bitsPerPixel == 32) 411 { 342 412 mPixelFormat = FramebufferPixelFormat_FOURCC_RGB; 343 413 mBufferAddress = reinterpret_cast<uint8_t *>(vram); … … 345 415 mBitsPerPixel = bitsPerPixel; 346 416 mRGBBuffer = NULL; 347 } else { 417 } 418 else 419 { 348 420 mPixelFormat = FramebufferPixelFormat_FOURCC_RGB; 349 421 mBytesPerLine = w * 4; … … 358 430 AssertReturn(mScreenBuffer != 0, E_OUTOFMEMORY); 359 431 360 for (ULONG i = 0; i < mBytesPerLine * h; i += 4) { 432 for (ULONG i = 0; i < mBytesPerLine * h; i += 4) 433 { 361 434 mScreenBuffer[i] = mBufferAddress[i+2]; 362 435 mScreenBuffer[i+1] = mBufferAddress[i+1]; … … 364 437 } 365 438 366 RTPrintf("Set framebuffer: buffer=%d w=%lu h=%lu bpp=%d\n", mBufferAddress, mWidth, mHeight, (int)mBitsPerPixel); 439 RTPrintf("Set framebuffer: buffer=%llx w=%lu h=%lu bpp=%d\n", 440 (uint64_t)mBufferAddress, mWidth, mHeight, (int)mBitsPerPixel); 367 441 rfbNewFramebuffer(vncServer, (char*)mScreenBuffer, mWidth, mHeight, 8, 3, mBitsPerPixel / 8); 368 if (oldBuffer) RTMemFree(oldBuffer); 442 if (oldBuffer) 443 RTMemFree(oldBuffer); 369 444 return S_OK; 370 445 } 371 446 372 447 //Guest framebuffer update notification 373 STDMETHODIMP VNCFB::NotifyUpdate(ULONG x, ULONG y, ULONG w, ULONG h) { 374 if (!mBufferAddress || !mScreenBuffer) return S_OK; 448 STDMETHODIMP VNCFB::NotifyUpdate(ULONG x, ULONG y, ULONG w, ULONG h) 449 { 450 if (!mBufferAddress || !mScreenBuffer) 451 return S_OK; 375 452 ULONG joff = y * mBytesPerLine + x * 4; 376 453 for (ULONG j = joff; j < joff + h * mBytesPerLine; j += mBytesPerLine) 377 for (ULONG i = j; i < j + w * 4; i += 4) { 378 mScreenBuffer[i] = mBufferAddress[i+2]; 379 mScreenBuffer[i+1] = mBufferAddress[i+1]; 380 mScreenBuffer[i+2] = mBufferAddress[i]; 381 } 454 for (ULONG i = j; i < j + w * 4; i += 4) 455 { 456 mScreenBuffer[i] = mBufferAddress[i+2]; 457 mScreenBuffer[i+1] = mBufferAddress[i+1]; 458 mScreenBuffer[i+2] = mBufferAddress[i]; 459 } 382 460 rfbMarkRectAsModified(vncServer, x, y, x+w, y+h); 383 461 return S_OK; 384 462 } 385 386 387 463 388 464 … … 396 472 * @retval address The address of the buffer 397 473 */ 398 STDMETHODIMP VNCFB::COMGETTER(Address) (BYTE **address) { 399 if (!address) return E_POINTER; 474 STDMETHODIMP VNCFB::COMGETTER(Address) (BYTE **address) 475 { 476 if (!address) 477 return E_POINTER; 400 478 LogFlow(("FFmpeg::COMGETTER(Address): returning address %p\n", mBufferAddress)); 401 479 *address = mBufferAddress; … … 409 487 * @retval width The width of the frame buffer 410 488 */ 411 STDMETHODIMP VNCFB::COMGETTER(Width) (ULONG *width) { 412 if (!width) return E_POINTER; 489 STDMETHODIMP VNCFB::COMGETTER(Width) (ULONG *width) 490 { 491 if (!width) 492 return E_POINTER; 413 493 LogFlow(("FFmpeg::COMGETTER(Width): returning width %lu\n", (unsigned long) mWidth)); 414 494 *width = mWidth; … … 422 502 * @retval height The height of the frame buffer 423 503 */ 424 STDMETHODIMP VNCFB::COMGETTER(Height) (ULONG *height) { 425 if (!height) return E_POINTER; 504 STDMETHODIMP VNCFB::COMGETTER(Height) (ULONG *height) 505 { 506 if (!height) 507 return E_POINTER; 426 508 LogFlow(("FFmpeg::COMGETTER(Height): returning height %lu\n", (unsigned long) mHeight)); 427 509 *height = mHeight; … … 439 521 * @retval bitsPerPixel The colour depth of the frame buffer 440 522 */ 441 STDMETHODIMP VNCFB::COMGETTER(BitsPerPixel) (ULONG *bitsPerPixel) { 442 if (!bitsPerPixel) return E_POINTER; 523 STDMETHODIMP VNCFB::COMGETTER(BitsPerPixel) (ULONG *bitsPerPixel) 524 { 525 if (!bitsPerPixel) 526 return E_POINTER; 443 527 *bitsPerPixel = mBitsPerPixel; 444 528 LogFlow(("FFmpeg::COMGETTER(BitsPerPixel): returning depth %lu\n", … … 453 537 * @retval bytesPerLine The number of bytes per line 454 538 */ 455 STDMETHODIMP VNCFB::COMGETTER(BytesPerLine) (ULONG *bytesPerLine) { 456 if (!bytesPerLine) return E_POINTER; 539 STDMETHODIMP VNCFB::COMGETTER(BytesPerLine) (ULONG *bytesPerLine) 540 { 541 if (!bytesPerLine) 542 return E_POINTER; 457 543 LogFlow(("FFmpeg::COMGETTER(BytesPerLine): returning line size %lu\n", (unsigned long) mBytesPerLine)); 458 544 *bytesPerLine = mBytesPerLine; … … 466 552 * @retval pixelFormat The pixel layout 467 553 */ 468 STDMETHODIMP VNCFB::COMGETTER(PixelFormat) (ULONG *pixelFormat) { 469 if (!pixelFormat) return E_POINTER; 554 STDMETHODIMP VNCFB::COMGETTER(PixelFormat) (ULONG *pixelFormat) 555 { 556 if (!pixelFormat) 557 return E_POINTER; 470 558 LogFlow(("FFmpeg::COMGETTER(PixelFormat): returning pixel format: %lu\n", (unsigned long) mPixelFormat)); 471 559 *pixelFormat = mPixelFormat; … … 479 567 * @retval pixelFormat The pixel layout 480 568 */ 481 STDMETHODIMP VNCFB::COMGETTER(UsesGuestVRAM) (BOOL *usesGuestVRAM) { 482 if (!usesGuestVRAM) return E_POINTER; 569 STDMETHODIMP VNCFB::COMGETTER(UsesGuestVRAM) (BOOL *usesGuestVRAM) 570 { 571 if (!usesGuestVRAM) 572 return E_POINTER; 483 573 LogFlow(("FFmpeg::COMGETTER(UsesGuestVRAM): uses guest VRAM? %d\n", mRGBBuffer == NULL)); 484 574 *usesGuestVRAM = (mRGBBuffer == NULL); … … 493 583 * @retval heightReduction The number of unused lines 494 584 */ 495 STDMETHODIMP VNCFB::COMGETTER(HeightReduction) (ULONG *heightReduction) { 496 if (!heightReduction) return E_POINTER; 585 STDMETHODIMP VNCFB::COMGETTER(HeightReduction) (ULONG *heightReduction) 586 { 587 if (!heightReduction) 588 return E_POINTER; 497 589 /* no reduction */ 498 590 *heightReduction = 0; … … 508 600 * @retval aOverlay The overlay framebuffer 509 601 */ 510 STDMETHODIMP VNCFB::COMGETTER(Overlay) (IFramebufferOverlay **aOverlay) { 511 if (!aOverlay) return E_POINTER; 602 STDMETHODIMP VNCFB::COMGETTER(Overlay) (IFramebufferOverlay **aOverlay) 603 { 604 if (!aOverlay) 605 return E_POINTER; 512 606 /* not yet implemented */ 513 607 *aOverlay = 0; … … 522 616 * @retval winId Associated window id 523 617 */ 524 STDMETHODIMP VNCFB::COMGETTER(WinId) (ULONG64 *winId) { 525 if (!winId) return E_POINTER; 618 STDMETHODIMP VNCFB::COMGETTER(WinId) (ULONG64 *winId) 619 { 620 if (!winId) 621 return E_POINTER; 526 622 *winId = 0; 527 623 return S_OK; … … 531 627 ///////////////////////////////////////////////////////////////////////////// 532 628 533 STDMETHODIMP VNCFB::Lock() { 629 STDMETHODIMP VNCFB::Lock() 630 { 534 631 LogFlow(("VNCFB::Lock: called\n")); 535 632 int rc = RTCritSectEnter(&mCritSect); 536 633 AssertRC(rc); 537 if (rc == VINF_SUCCESS) return S_OK; 634 if (rc == VINF_SUCCESS) 635 return S_OK; 538 636 return E_UNEXPECTED; 539 637 } 540 638 541 STDMETHODIMP VNCFB::Unlock() { 639 STDMETHODIMP VNCFB::Unlock() 640 { 542 641 LogFlow(("VNCFB::Unlock: called\n")); 543 642 RTCritSectLeave(&mCritSect); … … 545 644 } 546 645 547 548 646 /** 549 647 * Returns whether we like the given video mode. … … 551 649 * @returns COM status code 552 650 */ 553 STDMETHODIMP VNCFB::VideoModeSupported(ULONG width, ULONG height, ULONG bpp, BOOL *supported) { 554 if (!supported) return E_POINTER; 651 STDMETHODIMP VNCFB::VideoModeSupported(ULONG width, ULONG height, ULONG bpp, BOOL *supported) 652 { 653 if (!supported) 654 return E_POINTER; 555 655 *supported = true; 556 656 return S_OK; … … 558 658 559 659 /** Stubbed */ 560 STDMETHODIMP VNCFB::GetVisibleRegion(BYTE *rectangles, ULONG /* count */, ULONG * /* countCopied */) { 561 if (!rectangles) return E_POINTER; 660 STDMETHODIMP VNCFB::GetVisibleRegion(BYTE *rectangles, ULONG /* count */, ULONG * /* countCopied */) 661 { 662 if (!rectangles) 663 return E_POINTER; 562 664 *rectangles = 0; 563 665 return S_OK; … … 565 667 566 668 /** Stubbed */ 567 STDMETHODIMP VNCFB::SetVisibleRegion(BYTE *rectangles, ULONG /* count */) { 568 if (!rectangles) return E_POINTER; 569 return S_OK; 570 } 571 572 STDMETHODIMP VNCFB::ProcessVHWACommand(BYTE *pCommand) { 669 STDMETHODIMP VNCFB::SetVisibleRegion(BYTE *rectangles, ULONG /* count */) 670 { 671 if (!rectangles) 672 return E_POINTER; 673 return S_OK; 674 } 675 676 STDMETHODIMP VNCFB::ProcessVHWACommand(BYTE *pCommand) 677 { 573 678 return E_NOTIMPL; 574 679 } -
trunk/src/VBox/Frontends/VBoxHeadless/FramebufferVNC.h
r28800 r30200 43 43 STDMETHOD_(ULONG, Release)() { 44 44 long cnt = ::InterlockedDecrement (&refcnt); 45 if (cnt == 0) delete this; 45 if (cnt == 0) 46 delete this; 46 47 return cnt; 47 48 } … … 52 53 53 54 // public methods only for internal purposes 54 HRESULT init (); 55 HRESULT init (const char *pszName); 56 void enableAbsMouse(bool fEnable); 55 57 56 58 STDMETHOD(COMGETTER(Width))(ULONG *width); … … 104 106 void kbdPutCodeShift(int shift, int code, int down); 105 107 108 bool fAbsMouseEnabled; 109 106 110 ULONG mWidth, mHeight; 107 111 -
trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp
r30109 r30200 81 81 static IConsole *gConsole = NULL; 82 82 static EventQueue *gEventQ = NULL; 83 84 #ifdef VBOX_WITH_VNC 85 static VNCFB *g_pFramebufferVNC; 86 #endif 87 83 88 84 89 //////////////////////////////////////////////////////////////////////////////// … … 322 327 } 323 328 } 329 #ifdef VBOX_WITH_VNC 330 if (g_pFramebufferVNC) 331 g_pFramebufferVNC->enableAbsMouse(supportsAbsolute); 332 #endif 324 333 return S_OK; 325 334 } … … 963 972 if (fVNCEnable) 964 973 { 965 VNCFB *pFramebufferVNC = new VNCFB(console, uVNCPort, pszVNCPassword); 966 rc = pFramebufferVNC->init(); 974 Bstr name; 975 machine->COMGETTER(Name)(name.asOutParam()); 976 g_pFramebufferVNC = new VNCFB(console, uVNCPort, pszVNCPassword); 977 rc = g_pFramebufferVNC->init(name ? Utf8Str(name).raw() : ""); 967 978 if (rc != S_OK) 968 979 { 969 980 LogError("Failed to load the vnc server extension, possibly due to a damaged file\n", rc); 970 delete pFramebufferVNC;981 delete g_pFramebufferVNC; 971 982 break; 972 983 } 973 984 974 985 Log2(("VBoxHeadless: Registering VNC framebuffer\n")); 975 pFramebufferVNC->AddRef();976 display->SetFramebuffer(VBOX_VIDEO_PRIMARY_SCREEN, pFramebufferVNC);986 g_pFramebufferVNC->AddRef(); 987 display->SetFramebuffer(VBOX_VIDEO_PRIMARY_SCREEN, g_pFramebufferVNC); 977 988 } 978 989 if (rc != S_OK) … … 986 997 for (uScreenId = 0; uScreenId < cMonitors; uScreenId++) 987 998 { 988 # ifdef VBOX_FFMPEG999 # ifdef VBOX_FFMPEG 989 1000 if (fFFMPEG && uScreenId == 0) 990 1001 { … … 992 1003 continue; 993 1004 } 994 #endif /* defined(VBOX_FFMPEG) */ 1005 # endif 1006 # ifdef VBOX_WITH_VNC 1007 if (fVNCEnable && uScreenId == 0) 1008 { 1009 /* Already registered. */ 1010 continue; 1011 } 1012 # endif 995 1013 VRDPFramebuffer *pVRDPFramebuffer = new VRDPFramebuffer(); 996 1014 if (!pVRDPFramebuffer)
Note:
See TracChangeset
for help on using the changeset viewer.