Changeset 29518 in vbox
- Timestamp:
- May 17, 2010 10:06:22 AM (14 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 12 edited
-
Frontends/VBoxHeadless/VBoxHeadless.cpp (modified) (2 diffs)
-
Frontends/VBoxSDL/VBoxSDL.cpp (modified) (5 diffs)
-
Frontends/VirtualBox/src/VBoxConsoleView.cpp (modified) (4 diffs)
-
Frontends/VirtualBox/src/runtime/UISession.cpp (modified) (4 diffs)
-
Main/ConsoleImpl.cpp (modified) (5 diffs)
-
Main/ConsoleVRDPServer.cpp (modified) (4 diffs)
-
Main/DisplayImpl.cpp (modified) (1 diff)
-
Main/VMMDevInterface.cpp (modified) (1 diff)
-
Main/VirtualBoxCallbackImpl.cpp (modified) (1 diff)
-
Main/idl/VirtualBox.xidl (modified) (1 diff)
-
Main/include/ConsoleImpl.h (modified) (3 diffs)
-
Main/include/DisplayImpl.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp
r28960 r29518 305 305 306 306 STDMETHOD(OnMousePointerShapeChange)(BOOL visible, BOOL alpha, ULONG xHot, ULONG yHot, 307 ULONG width, ULONG height, BYTE *shape)307 ULONG width, ULONG height, ComSafeArrayIn(BYTE,shape)) 308 308 { 309 309 return VBOX_E_DONT_CALL_AGAIN; … … 1243 1243 } 1244 1244 #endif /* !VBOX_WITH_HARDENING */ 1245 -
trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp
r29431 r29518 100 100 { 101 101 PointerShapeChangeData(BOOL aVisible, BOOL aAlpha, ULONG aXHot, ULONG aYHot, 102 ULONG aWidth, ULONG aHeight, const uint8_t *aShape)102 ULONG aWidth, ULONG aHeight, ComSafeArrayIn(BYTE,pShape)) 103 103 : visible(aVisible), alpha(aAlpha), xHot(aXHot), yHot(aYHot), 104 width(aWidth), height(aHeight) , shape(NULL)104 width(aWidth), height(aHeight) 105 105 { 106 106 // make a copy of the shape 107 if (aShape) 108 { 109 uint32_t shapeSize = ((((aWidth + 7) / 8) * aHeight + 3) & ~3) + aWidth * 4 * aHeight; 110 shape = new uint8_t [shapeSize]; 111 if (shape) 112 memcpy((void *)shape, (void *)aShape, shapeSize); 113 } 107 com::SafeArray <BYTE> aShape(ComSafeArrayInArg (pShape)); 108 size_t cbShapeSize = aShape.size(); 109 shape.resize(cbShapeSize); 110 ::memcpy(shape.raw(), aShape.raw(), cbShapeSize); 114 111 } 115 112 116 113 ~PointerShapeChangeData() 117 114 { 118 if (shape) delete[] shape;119 115 } 120 116 … … 125 121 const ULONG width; 126 122 const ULONG height; 127 co nst uint8_t *shape;123 com::SafeArray<BYTE> shape; 128 124 }; 129 125 … … 401 397 402 398 STDMETHOD(OnMousePointerShapeChange)(BOOL visible, BOOL alpha, ULONG xHot, ULONG yHot, 403 ULONG width, ULONG height, BYTE *shape)399 ULONG width, ULONG height, ComSafeArrayIn(BYTE, shape)) 404 400 { 405 401 PointerShapeChangeData *data; 406 402 data = new PointerShapeChangeData(visible, alpha, xHot, yHot, width, height, 407 shape);403 ComSafeArrayInArg(shape)); 408 404 Assert(data); 409 405 if (!data) … … 4430 4426 return; 4431 4427 4432 if (data->shape )4428 if (data->shape.size() > 0) 4433 4429 { 4434 4430 bool ok = false; … … 4437 4433 uint32_t srcShapePtrScan = data->width * 4; 4438 4434 4439 const uint8_t *srcAndMaskPtr = data->shape; 4440 const uint8_t *srcShapePtr = data->shape + ((andMaskSize + 3) & ~3); 4435 const uint8_t* shape = data->shape.raw(); 4436 const uint8_t *srcAndMaskPtr = shape; 4437 const uint8_t *srcShapePtr = shape + ((andMaskSize + 3) & ~3); 4441 4438 4442 4439 #if 0 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp
r28960 r29518 30 30 #include "VBoxGlobal.h" 31 31 #include "VBoxProblemReporter.h" 32 #include "VBox/com/array.h" 32 33 33 34 #ifdef Q_WS_PM … … 209 210 MousePointerChangeEvent (bool visible, bool alpha, uint xhot, uint yhot, 210 211 uint width, uint height, 211 const uchar *shape) :212 ComSafeArrayIn(BYTE,pShape)) : 212 213 QEvent ((QEvent::Type) VBoxDefs::MousePointerChangeEventType), 213 vis (visible), alph (alpha), xh (xhot), yh (yhot), w (width), h (height), 214 data (NULL) 215 { 216 // make a copy of shape 217 uint dataSize = ((((width + 7) / 8 * height) + 3) & ~3) + width * 4 * height; 218 219 if (shape) { 220 data = new uchar [dataSize]; 221 memcpy ((void *) data, (void *) shape, dataSize); 222 } 214 vis (visible), alph (alpha), xh (xhot), yh (yhot), w (width), h (height) 215 { 216 com::SafeArray <BYTE> aShape(ComSafeArrayInArg (pShape)); 217 size_t cbShapeSize = aShape.size(); 218 shape.resize(cbShapeSize); 219 ::memcpy(shape.raw(), aShape.raw(), cbShapeSize); 223 220 } 224 221 ~MousePointerChangeEvent() 225 222 { 226 if (data) delete[] data;227 223 } 228 224 bool isVisible() const { return vis; } … … 232 228 uint width() const { return w; } 233 229 uint height() const { return h; } 234 const uchar *shapeData() const { return data; }230 const uchar *shapeData() const { return shape.raw(); } 235 231 private: 236 232 bool vis, alph; 237 233 uint xh, yh, w, h; 238 co nst uchar *data;234 com::SafeArray <uint8_t> shape; 239 235 }; 240 236 … … 423 419 ULONG xhot, ULONG yhot, 424 420 ULONG width, ULONG height, 425 BYTE *shape)421 ComSafeArrayIn(BYTE,shape)) 426 422 { 427 423 QApplication::postEvent (mView, 428 424 new MousePointerChangeEvent (visible, alpha, 429 425 xhot, yhot, 430 width, height, shape));426 width, height, ComSafeArrayInArg(shape))); 431 427 return S_OK; 432 428 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r29485 r29518 55 55 public: 56 56 57 UIMousePointerShapeChangeEvent(bool bIsVisible, bool bIsAlpha, uint uXHot, uint uYHot, uint uWidth, uint uHeight, const uchar *pShape)57 UIMousePointerShapeChangeEvent(bool bIsVisible, bool bIsAlpha, uint uXHot, uint uYHot, uint uWidth, uint uHeight, ComSafeArrayIn(BYTE,pShape)) 58 58 : QEvent((QEvent::Type)UIConsoleEventType_MousePointerShapeChange) 59 , m_bIsVisible(bIsVisible), m_bIsAlpha(bIsAlpha), m_uXHot(uXHot), m_uYHot(uYHot), m_uWidth(uWidth), m_uHeight(uHeight), m_pData(0) 60 { 61 uint dataSize = ((((m_uWidth + 7) / 8 * m_uHeight) + 3) & ~3) + m_uWidth * 4 * m_uHeight; 62 if (pShape) 63 { 64 m_pData = new uchar[dataSize]; 65 memcpy((void*)m_pData, (void*)pShape, dataSize); 66 } 59 , m_bIsVisible(bIsVisible), m_bIsAlpha(bIsAlpha), m_uXHot(uXHot), m_uYHot(uYHot), m_uWidth(uWidth), m_uHeight(uHeight) 60 { 61 com::SafeArray <BYTE> aShape(ComSafeArrayInArg (pShape)); 62 size_t cbShapeSize = aShape.size(); 63 m_shape.resize(cbShapeSize); 64 ::memcpy(m_shape.raw(), aShape.raw(), cbShapeSize); 67 65 } 68 66 69 67 virtual ~UIMousePointerShapeChangeEvent() 70 68 { 71 if (m_pData) delete[] m_pData;72 69 } 73 70 … … 78 75 uint width() const { return m_uWidth; } 79 76 uint height() const { return m_uHeight; } 80 const uchar *shapeData() const { return m_ pData; }77 const uchar *shapeData() const { return m_shape.raw(); } 81 78 82 79 private: … … 84 81 bool m_bIsVisible, m_bIsAlpha; 85 82 uint m_uXHot, m_uYHot, m_uWidth, m_uHeight; 86 co nst uchar *m_pData;83 com::SafeArray <uint8_t> m_shape; 87 84 }; 88 85 … … 386 383 VBOX_SCRIPTABLE_DISPATCH_IMPL(IConsoleCallback) 387 384 388 STDMETHOD(OnMousePointerShapeChange)(BOOL bIsVisible, BOOL bAlpha, ULONG uXHot, ULONG uYHot, ULONG uWidth, ULONG uHeight, BYTE *pShape)389 { 390 QApplication::postEvent(m_pEventHandler, new UIMousePointerShapeChangeEvent(bIsVisible, bAlpha, uXHot, uYHot, uWidth, uHeight, pShape));385 STDMETHOD(OnMousePointerShapeChange)(BOOL bIsVisible, BOOL bAlpha, ULONG uXHot, ULONG uYHot, ULONG uWidth, ULONG uHeight, ComSafeArrayIn(BYTE,pShape)) 386 { 387 QApplication::postEvent(m_pEventHandler, new UIMousePointerShapeChangeEvent(bIsVisible, bAlpha, uXHot, uYHot, uWidth, uHeight, ComSafeArrayInArg(pShape))); 391 388 return S_OK; 392 389 } -
trunk/src/VBox/Main/ConsoleImpl.cpp
r29480 r29518 618 618 /* dynamically allocated members of mCallbackData are uninitialized 619 619 * at the end of powerDown() */ 620 Assert(!mCallbackData.mpsc.valid && mCallbackData.mpsc.shape == NULL);620 Assert(!mCallbackData.mpsc.valid && mCallbackData.mpsc.shape.isNull()); 621 621 Assert(!mCallbackData.mcc.valid); 622 622 Assert(!mCallbackData.klc.valid); … … 3026 3026 mCallbackData.mpsc.width, 3027 3027 mCallbackData.mpsc.height, 3028 mCallbackData.mpsc.shape);3028 ComSafeArrayAsInParam(mCallbackData.mpsc.shape)); 3029 3029 if (mCallbackData.mcc.valid) 3030 3030 aCallback->OnMouseCapabilityChange(mCallbackData.mcc.supportsAbsolute, … … 4642 4642 uint32_t xHot, uint32_t yHot, 4643 4643 uint32_t width, uint32_t height, 4644 void *pShape)4644 ComSafeArrayIn(BYTE,pShape)) 4645 4645 { 4646 4646 #if 0 … … 4668 4668 mCallbackData.mpsc.valid = false; 4669 4669 4670 if (pShape != NULL) 4671 { 4672 size_t cb = (width + 7) / 8 * height; /* size of the AND mask */ 4673 cb = ((cb + 3) & ~3) + width * 4 * height; /* + gap + size of the XOR mask */ 4674 /* try to reuse the old shape buffer if the size is the same */ 4675 if (!wasValid) 4676 mCallbackData.mpsc.shape = NULL; 4677 else 4678 if (mCallbackData.mpsc.shape != NULL && mCallbackData.mpsc.shapeSize != cb) 4679 { 4680 RTMemFree(mCallbackData.mpsc.shape); 4681 mCallbackData.mpsc.shape = NULL; 4682 } 4683 if (mCallbackData.mpsc.shape == NULL) 4684 { 4685 mCallbackData.mpsc.shape = (BYTE *) RTMemAllocZ(cb); 4686 AssertReturnVoid(mCallbackData.mpsc.shape); 4687 } 4688 mCallbackData.mpsc.shapeSize = cb; 4689 memcpy(mCallbackData.mpsc.shape, pShape, cb); 4670 com::SafeArray <BYTE> aShape(ComSafeArrayInArg (pShape)); 4671 if (aShape.size() != 0) 4672 { 4673 mCallbackData.mpsc.shape.resize(aShape.size()); 4674 ::memcpy( mCallbackData.mpsc.shape.raw(), aShape.raw(), aShape.size()); 4690 4675 } 4691 4676 else 4692 { 4693 if (wasValid && mCallbackData.mpsc.shape != NULL) 4694 RTMemFree(mCallbackData.mpsc.shape); 4695 mCallbackData.mpsc.shape = NULL; 4696 mCallbackData.mpsc.shapeSize = 0; 4697 } 4698 4677 mCallbackData.mpsc.shape.setNull(); 4699 4678 mCallbackData.mpsc.valid = true; 4700 4679 4701 CONSOLE_DO_CALLBACKS(OnMousePointerShapeChange,(fVisible, fAlpha, xHot, yHot, width, height, (BYTE *) pShape));4680 CONSOLE_DO_CALLBACKS(OnMousePointerShapeChange,(fVisible, fAlpha, xHot, yHot, width, height, ComSafeArrayInArg(pShape))); 4702 4681 4703 4682 #if 0 … … 5666 5645 /* uninit dynamically allocated members of mCallbackData */ 5667 5646 if (mCallbackData.mpsc.valid) 5668 { 5669 if (mCallbackData.mpsc.shape != NULL) 5670 RTMemFree(mCallbackData.mpsc.shape); 5671 } 5647 mCallbackData.mpsc.shape.setNull(); 5672 5648 memset(&mCallbackData, 0, sizeof(mCallbackData)); 5673 5649 } -
trunk/src/VBox/Main/ConsoleVRDPServer.cpp
r29386 r29518 82 82 83 83 STDMETHOD(OnMousePointerShapeChange)(BOOL visible, BOOL alpha, ULONG xHot, ULONG yHot, 84 ULONG width, ULONG height, BYTE *shape);84 ULONG width, ULONG height, ComSafeArrayIn(BYTE,shape)); 85 85 86 86 STDMETHOD(OnMouseCapabilityChange)(BOOL supportsAbsolute, BOOL supportsRelative, BOOL needsHostCursor) … … 431 431 ULONG width, 432 432 ULONG height, 433 BYTE *shape)433 ComSafeArrayIn(BYTE,inShape)) 434 434 { 435 435 LogSunlover(("VRDPConsoleCallback::OnMousePointerShapeChange: %d, %d, %lux%lu, @%lu,%lu\n", visible, alpha, width, height, xHot, yHot)); … … 437 437 if (m_server) 438 438 { 439 if (!shape) 439 com::SafeArray <BYTE> aShape(ComSafeArrayInArg (inShape)); 440 if (aShape.size() == 0) 440 441 { 441 442 if (!visible) … … 462 463 * because most pointers are 32x32. 463 464 */ 465 uint8_t* shape = aShape.raw(); 464 466 465 467 dumpPointer(shape, width, height, true); -
trunk/src/VBox/Main/DisplayImpl.cpp
r28927 r29518 3829 3829 Display *pThis = pDrv->pDisplay; 3830 3830 3831 size_t cbShapeSize = (cx + 7) / 8 * cy; /* size of the AND mask */ 3832 cbShapeSize = ((cbShapeSize + 3) & ~3) + cx * 4 * cy; /* + gap + size of the XOR mask */ 3833 com::SafeArray<BYTE> shapeData(cbShapeSize); 3834 ::memcpy(shapeData.raw(), pvShape, cbShapeSize); 3835 3831 3836 /* Tell the console about it */ 3832 3837 pDrv->pDisplay->mParent->onMousePointerShapeChange(fVisible, fAlpha, 3833 xHot, yHot, cx, cy, (void *)pvShape);3838 xHot, yHot, cx, cy, ComSafeArrayAsInParam(shapeData)); 3834 3839 3835 3840 return VINF_SUCCESS; -
trunk/src/VBox/Main/VMMDevInterface.cpp
r29404 r29518 284 284 285 285 /* tell the console about it */ 286 size_t cbShapeSize = (width + 7) / 8 * height; /* size of the AND mask */ 287 cbShapeSize = ((cbShapeSize + 3) & ~3) + width * 4 * height; /* + gap + size of the XOR mask */ 288 com::SafeArray<BYTE> shapeData(cbShapeSize); 289 ::memcpy(shapeData.raw(), pShape, cbShapeSize); 286 290 pDrv->pVMMDev->getParent()->onMousePointerShapeChange(fVisible, fAlpha, 287 xHot, yHot, width, height, pShape);291 xHot, yHot, width, height, ComSafeArrayAsInParam(shapeData)); 288 292 } 289 293 -
trunk/src/VBox/Main/VirtualBoxCallbackImpl.cpp
r29453 r29518 162 162 ///////////////////////////////////////////////////////////////////////////// 163 163 STDMETHODIMP CallbackWrapper::OnMousePointerShapeChange(BOOL visible, BOOL alpha, ULONG xHot, ULONG yHot, 164 ULONG width, ULONG height, BYTE *shape) 165 { 166 if (mConsoleCallback.isNull()) 167 return S_OK; 168 169 #if defined(RT_OS_WINDOWS) && defined(RT_ARCH_AMD64) 170 /* Letting this thru crashes in VariantInit, probably because the last 171 parameter is a BYTE pointer. For now, don't let it thru to python or 172 what other users this class might have. */ 173 /** @todo Figure if this applies to 32-bit hosts as well. */ 174 /** @todo Find better solution? */ 175 return VBOX_E_DONT_CALL_AGAIN; 176 #else 177 return mConsoleCallback->OnMousePointerShapeChange(visible, alpha, xHot, yHot, width, height, shape); 178 #endif 164 ULONG width, ULONG height, ComSafeArrayIn(BYTE, shape)) 165 { 166 if (mConsoleCallback.isNull()) 167 return S_OK; 168 169 return mConsoleCallback->OnMousePointerShapeChange(visible, alpha, xHot, yHot, width, height, ComSafeArrayInArg(shape)); 179 170 } 180 171 -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r29516 r29518 6172 6172 </desc> 6173 6173 </param> 6174 <param name="shape" type="octet" mod="ptr" dir="in">6175 <desc> 6176 Address of the shape buffer.6174 <param name="shape" type="octet" safearray="yes" dir="in"> 6175 <desc> 6176 Shape buffer arrays. 6177 6177 6178 6178 The @a shape buffer contains a 1-bpp (bits per pixel) AND mask -
trunk/src/VBox/Main/include/ConsoleImpl.h
r29480 r29518 21 21 #include "VirtualBoxBase.h" 22 22 #include "SchemaDefs.h" 23 #include "VBox/com/array.h" 23 24 24 25 class Guest; … … 206 207 uint32_t xHot, uint32_t yHot, 207 208 uint32_t width, uint32_t height, 208 void *pShape);209 ComSafeArrayIn(uint8_t, aShape)); 209 210 void onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelative, BOOL needsHostCursor); 210 211 void onStateChange(MachineState_T aMachineState); … … 675 676 uint32_t width; 676 677 uint32_t height; 677 BYTE *shape; 678 size_t shapeSize; 678 com::SafeArray<BYTE> shape; 679 679 } 680 680 mpsc; -
trunk/src/VBox/Main/include/DisplayImpl.h
r28973 r29518 150 150 // IConsoleCallback methods 151 151 STDMETHOD(OnMousePointerShapeChange)(BOOL visible, BOOL alpha, ULONG xHot, ULONG yHot, 152 ULONG width, ULONG height, BYTE *shape)152 ULONG width, ULONG height, ComSafeArrayIn(BYTE,shape)) 153 153 { 154 154 return S_OK;
Note:
See TracChangeset
for help on using the changeset viewer.

