VirtualBox

source: vbox/trunk/src/VBox/Main/VirtualBoxCallbackImpl.cpp@ 29453

Last change on this file since 29453 was 29453, checked in by vboxsync, 15 years ago

CallbackWrapper::OnMousePointerShapeChange: Don't call into python on win.amd64 as it currently crashes.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.6 KB
Line 
1/** @file
2 *
3 * VBox Client callback COM Class implementation
4 */
5
6/*
7 * Copyright (C) 2009 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#include "VirtualBoxCallbackImpl.h"
19#include "Logging.h"
20
21HRESULT CallbackWrapper::FinalConstruct()
22{
23 return S_OK;
24}
25
26void CallbackWrapper::FinalRelease()
27{
28}
29
30// public initializers/uninitializers only for internal purposes
31HRESULT CallbackWrapper::init()
32{
33 return S_OK;
34}
35
36void CallbackWrapper::uninit(bool aFinalRelease)
37{
38}
39
40// ILocalOwner methods
41/////////////////////////////////////////////////////////////////////////////
42
43STDMETHODIMP CallbackWrapper::SetLocalObject(IUnknown *aCallback)
44{
45 if (aCallback == NULL)
46 {
47 mVBoxCallback.setNull();
48 mConsoleCallback.setNull();
49 return S_OK;
50 }
51
52 if (!VALID_PTR (aCallback))
53 return E_POINTER;
54
55 mVBoxCallback = aCallback;
56 mConsoleCallback = aCallback;
57
58 // or some other error code?
59 AssertReturn(!!mVBoxCallback || !!mConsoleCallback, E_FAIL);
60
61 return S_OK;
62}
63
64// IVirtualBoxCallback methods
65/////////////////////////////////////////////////////////////////////////////
66STDMETHODIMP CallbackWrapper::OnMachineStateChange(IN_BSTR machineId, MachineState_T state)
67{
68 if (mVBoxCallback.isNull())
69 return S_OK;
70
71 return mVBoxCallback->OnMachineStateChange(machineId, state);
72}
73
74STDMETHODIMP CallbackWrapper::OnMachineDataChange(IN_BSTR machineId)
75{
76 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
77
78 if (mVBoxCallback.isNull())
79 return S_OK;
80
81 return mVBoxCallback->OnMachineDataChange(machineId);
82}
83
84
85STDMETHODIMP CallbackWrapper::OnExtraDataCanChange(IN_BSTR machineId, IN_BSTR key, IN_BSTR value,
86 BSTR *error, BOOL *changeAllowed)
87{
88 if (mVBoxCallback.isNull())
89 return S_OK;
90
91 return mVBoxCallback->OnExtraDataCanChange(machineId, key, value, error, changeAllowed);
92}
93
94STDMETHODIMP CallbackWrapper::OnExtraDataChange(IN_BSTR machineId, IN_BSTR key, IN_BSTR value)
95{
96 if (mVBoxCallback.isNull())
97 return S_OK;
98
99 return mVBoxCallback->OnExtraDataChange(machineId, key, value);
100}
101
102STDMETHODIMP CallbackWrapper::OnMediumRegistered(IN_BSTR mediaId, DeviceType_T mediaType,
103 BOOL registered)
104{
105 if (mVBoxCallback.isNull())
106 return S_OK;
107
108 return mVBoxCallback->OnMediumRegistered(mediaId, mediaType, registered);
109}
110
111
112STDMETHODIMP CallbackWrapper::OnMachineRegistered(IN_BSTR aMachineId, BOOL registered)
113{
114 if (mVBoxCallback.isNull())
115 return S_OK;
116
117 return mVBoxCallback->OnMachineRegistered(aMachineId, registered);
118}
119
120STDMETHODIMP CallbackWrapper::OnSessionStateChange(IN_BSTR aMachineId, SessionState_T state)
121{
122 if (mVBoxCallback.isNull())
123 return S_OK;
124
125 return mVBoxCallback->OnSessionStateChange(aMachineId, state);
126}
127
128STDMETHODIMP CallbackWrapper::OnSnapshotTaken(IN_BSTR aMachineId, IN_BSTR aSnapshotId)
129{
130 if (mVBoxCallback.isNull())
131 return S_OK;
132
133 return mVBoxCallback->OnSnapshotTaken(aMachineId, aSnapshotId);
134}
135
136STDMETHODIMP CallbackWrapper::OnSnapshotDeleted(IN_BSTR aMachineId, IN_BSTR aSnapshotId)
137{
138 if (mVBoxCallback.isNull())
139 return S_OK;
140
141 return mVBoxCallback->OnSnapshotDeleted(aMachineId, aSnapshotId);
142}
143
144STDMETHODIMP CallbackWrapper::OnSnapshotChange(IN_BSTR aMachineId, IN_BSTR aSnapshotId)
145{
146 if (mVBoxCallback.isNull())
147 return S_OK;
148
149 return mVBoxCallback->OnSnapshotChange(aMachineId, aSnapshotId);
150}
151
152STDMETHODIMP CallbackWrapper::OnGuestPropertyChange(IN_BSTR aMachineId, IN_BSTR key, IN_BSTR value, IN_BSTR flags)
153{
154 if (mVBoxCallback.isNull())
155 return S_OK;
156
157 return mVBoxCallback->OnGuestPropertyChange(aMachineId, key, value, flags);
158}
159
160
161// IConsoleCallback methods
162/////////////////////////////////////////////////////////////////////////////
163STDMETHODIMP 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
179}
180
181
182STDMETHODIMP CallbackWrapper::OnMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelative, BOOL needsHostCursor)
183{
184 if (mConsoleCallback.isNull())
185 return S_OK;
186
187 return mConsoleCallback->OnMouseCapabilityChange(supportsAbsolute, supportsRelative, needsHostCursor);
188}
189
190STDMETHODIMP CallbackWrapper::OnKeyboardLedsChange(BOOL fNumLock, BOOL fCapsLock, BOOL fScrollLock)
191{
192 if (mConsoleCallback.isNull())
193 return S_OK;
194
195 return mConsoleCallback->OnKeyboardLedsChange(fNumLock, fCapsLock, fScrollLock);
196}
197
198STDMETHODIMP CallbackWrapper::OnStateChange(MachineState_T machineState)
199{
200 if (mConsoleCallback.isNull())
201 return S_OK;
202
203 return mConsoleCallback->OnStateChange(machineState);
204}
205
206STDMETHODIMP CallbackWrapper::OnAdditionsStateChange()
207{
208 if (mConsoleCallback.isNull())
209 return S_OK;
210
211 return mConsoleCallback->OnAdditionsStateChange();
212}
213
214STDMETHODIMP CallbackWrapper::OnNetworkAdapterChange(INetworkAdapter *aNetworkAdapter)
215{
216 if (mConsoleCallback.isNull())
217 return S_OK;
218
219 return mConsoleCallback->OnNetworkAdapterChange(aNetworkAdapter);
220}
221
222STDMETHODIMP CallbackWrapper::OnSerialPortChange(ISerialPort *aSerialPort)
223{
224 if (mConsoleCallback.isNull())
225 return S_OK;
226
227 return mConsoleCallback->OnSerialPortChange(aSerialPort);
228}
229
230STDMETHODIMP CallbackWrapper::OnParallelPortChange(IParallelPort *aParallelPort)
231{
232 if (mConsoleCallback.isNull())
233 return S_OK;
234
235 return mConsoleCallback->OnParallelPortChange(aParallelPort);
236}
237
238STDMETHODIMP CallbackWrapper::OnRemoteDisplayInfoChange()
239{
240 if (mConsoleCallback.isNull())
241 return S_OK;
242
243 return mConsoleCallback->OnRemoteDisplayInfoChange();
244}
245
246STDMETHODIMP CallbackWrapper::OnVRDPServerChange()
247{
248 if (mConsoleCallback.isNull())
249 return S_OK;
250
251 return mConsoleCallback->OnVRDPServerChange();
252}
253
254STDMETHODIMP CallbackWrapper::OnUSBControllerChange()
255{
256 if (mConsoleCallback.isNull())
257 return S_OK;
258
259 return mConsoleCallback->OnUSBControllerChange();
260}
261
262STDMETHODIMP CallbackWrapper::OnUSBDeviceStateChange(IUSBDevice *aDevice,
263 BOOL aAttached,
264 IVirtualBoxErrorInfo *aError)
265{
266 if (mConsoleCallback.isNull())
267 return S_OK;
268
269 return mConsoleCallback->OnUSBDeviceStateChange(aDevice, aAttached, aError);
270}
271
272STDMETHODIMP CallbackWrapper::OnSharedFolderChange(Scope_T aScope)
273{
274 if (mConsoleCallback.isNull())
275 return S_OK;
276
277 return mConsoleCallback->OnSharedFolderChange(aScope);
278}
279
280STDMETHODIMP CallbackWrapper::OnStorageControllerChange()
281{
282 if (mConsoleCallback.isNull())
283 return S_OK;
284
285 return mConsoleCallback->OnStorageControllerChange();
286}
287
288STDMETHODIMP CallbackWrapper::OnMediumChange(IMediumAttachment *aMediumAttachment)
289{
290 if (mConsoleCallback.isNull())
291 return S_OK;
292
293 return mConsoleCallback->OnMediumChange(aMediumAttachment);
294}
295
296STDMETHODIMP CallbackWrapper::OnCPUChange(ULONG aCPU, BOOL aRemove)
297{
298 if (mConsoleCallback.isNull())
299 return S_OK;
300
301 return mConsoleCallback->OnCPUChange(aCPU, aRemove);
302}
303
304STDMETHODIMP CallbackWrapper::OnRuntimeError(BOOL fFatal, IN_BSTR id, IN_BSTR message)
305{
306 if (mConsoleCallback.isNull())
307 return S_OK;
308
309 return mConsoleCallback->OnRuntimeError(fFatal, id, message);
310}
311
312STDMETHODIMP CallbackWrapper::OnCanShowWindow(BOOL *canShow)
313{
314 if (mConsoleCallback.isNull())
315 return S_OK;
316
317 return mConsoleCallback->OnCanShowWindow(canShow);
318}
319
320STDMETHODIMP CallbackWrapper::OnShowWindow(ULONG64 *winId)
321{
322 if (mConsoleCallback.isNull())
323 return S_OK;
324
325 return mConsoleCallback->OnShowWindow(winId);
326}
Note: See TracBrowser for help on using the repository browser.

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