Changeset 13606 in vbox for trunk/src/VBox/Main/MouseImpl.cpp
- Timestamp:
- Oct 28, 2008 10:36:13 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/MouseImpl.cpp
r11296 r13606 1 /* $Id $ */ 2 1 3 /** @file 2 4 * … … 5 7 6 8 /* 7 * Copyright (C) 2006-200 7Sun Microsystems, Inc.9 * Copyright (C) 2006-2008 Sun Microsystems, Inc. 8 10 * 9 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 52 54 ///////////////////////////////////////////////////////////////////////////// 53 55 56 DEFINE_EMPTY_CTOR_DTOR (Mouse) 57 54 58 HRESULT Mouse::FinalConstruct() 55 59 { 56 mParent = NULL;57 60 mpDrv = NULL; 58 61 return S_OK; … … 61 64 void Mouse::FinalRelease() 62 65 { 63 if (isReady()) 64 uninit(); 66 uninit(); 65 67 } 66 68 … … 76 78 HRESULT Mouse::init (Console *parent) 77 79 { 78 LogFlow(("Mouse::init() : isReady=%d\n", isReady()));80 LogFlow(("Mouse::init()\n")); 79 81 80 82 ComAssertRet (parent, E_INVALIDARG); 81 83 82 AutoWriteLock alock (this); 83 ComAssertRet (!isReady(), E_UNEXPECTED); 84 85 mParent = parent; 84 /* Enclose the state transition NotReady->InInit->Ready */ 85 AutoInitSpan autoInitSpan (this); 86 AssertReturn (autoInitSpan.isOk(), E_UNEXPECTED); 87 88 unconst(mParent) = parent; 86 89 87 90 #ifdef RT_OS_L4 … … 92 95 #endif 93 96 94 setReady (true); 97 /* Confirm a successful initialization */ 98 autoInitSpan.setSucceeded(); 99 95 100 return S_OK; 96 101 } … … 102 107 void Mouse::uninit() 103 108 { 104 LogFlow(("Mouse::uninit(): isReady=%d\n", isReady())); 105 106 AutoWriteLock alock (this); 107 AssertReturn (isReady(), (void) 0); 109 LogFlowThisFunc (("\n")); 110 111 /* Enclose the state transition Ready->InUninit->NotReady */ 112 AutoUninitSpan autoUninitSpan (this); 113 if (autoUninitSpan.uninitDone()) 114 return; 108 115 109 116 if (mpDrv) … … 111 118 mpDrv = NULL; 112 119 113 setReady (false);120 unconst (mParent).setNull(); 114 121 } 115 122 … … 129 136 return E_POINTER; 130 137 138 AutoCaller autoCaller (this); 139 CheckComRCReturnRC (autoCaller.rc()); 140 131 141 AutoWriteLock alock (this); 132 CHECK_READY();133 142 134 143 CHECK_CONSOLE_DRV (mpDrv); … … 141 150 mParent->getVMMDev()->getVMMDevPort()->pfnQueryMouseCapabilities(mParent->getVMMDev()->getVMMDevPort(), &mouseCaps); 142 151 *absoluteSupported = mouseCaps & VMMDEV_MOUSEGUESTWANTSABS; 152 143 153 return S_OK; 144 154 } … … 156 166 return E_POINTER; 157 167 168 AutoCaller autoCaller (this); 169 CheckComRCReturnRC (autoCaller.rc()); 170 158 171 AutoWriteLock alock (this); 159 CHECK_READY();160 172 161 173 CHECK_CONSOLE_DRV (mpDrv); … … 168 180 mParent->getVMMDev()->getVMMDevPort()->pfnQueryMouseCapabilities(mParent->getVMMDev()->getVMMDevPort(), &mouseCaps); 169 181 *needsHostCursor = mouseCaps & VMMDEV_MOUSEGUESTNEEDSHOSTCUR; 182 170 183 return S_OK; 171 184 } … … 185 198 STDMETHODIMP Mouse::PutMouseEvent(LONG dx, LONG dy, LONG dz, LONG buttonState) 186 199 { 200 HRESULT rc = S_OK; 201 202 AutoCaller autoCaller (this); 203 CheckComRCReturnRC (autoCaller.rc()); 204 187 205 AutoWriteLock alock (this); 188 CHECK_READY();189 206 190 207 CHECK_CONSOLE_DRV (mpDrv); … … 218 235 int vrc = mpDrv->pUpPort->pfnPutEvent(mpDrv->pUpPort, dx, dy, dz, fButtons); 219 236 if (VBOX_FAILURE (vrc)) 220 return setError (E_FAIL, 221 tr ("Could not send the mouse event to the virtual mouse (%Vrc)"), 222 vrc); 223 224 return S_OK; 237 rc = setError (E_FAIL, tr ("Could not send the mouse event to the virtual mouse (%Vrc)"), 238 vrc); 239 240 return rc; 225 241 } 226 242 … … 238 254 LONG buttonState) 239 255 { 256 HRESULT rc = S_OK; 257 258 AutoCaller autoCaller (this); 259 CheckComRCReturnRC (autoCaller.rc()); 260 240 261 AutoWriteLock alock (this); 241 CHECK_READY();242 262 243 263 CHECK_CONSOLE_DRV (mpDrv); … … 267 287 ULONG displayWidth; 268 288 ULONG displayHeight; 269 HRESULTrc = pDisplay->COMGETTER(Width)(&displayWidth);289 rc = pDisplay->COMGETTER(Width)(&displayWidth); 270 290 ComAssertComRCRet (rc, rc); 271 291 rc = pDisplay->COMGETTER(Height)(&displayHeight); … … 297 317 fButtons); 298 318 if (VBOX_FAILURE (vrc)) 299 return setError (E_FAIL, 300 tr ("Could not send the mouse event to the virtual mouse (%Vrc)"), 301 vrc); 302 } 303 304 return S_OK; 319 rc = setError (E_FAIL, tr ("Could not send the mouse event to the virtual mouse (%Vrc)"), 320 vrc); 321 } 322 323 return rc; 305 324 } 306 325
Note:
See TracChangeset
for help on using the changeset viewer.