Changeset 33061 in vbox
- Timestamp:
- Oct 12, 2010 12:42:20 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/com/array.h
r31718 r33061 1224 1224 resize(aSize); 1225 1225 ::memcpy(raw(), aPtr, aSize); 1226 } 1227 1228 1229 template<> 1230 inline void com::SafeArray<LONG>::initFrom(const com::SafeArray<LONG> & aRef) 1231 { 1232 size_t sSize = aRef.size(); 1233 resize(sSize); 1234 ::memcpy(raw(), aRef.raw(), sSize * sizeof(LONG)); 1235 } 1236 template<> 1237 inline void com::SafeArray<LONG>::initFrom(const LONG* aPtr, size_t aSize) 1238 { 1239 resize(aSize); 1240 ::memcpy(raw(), aPtr, aSize * sizeof(LONG)); 1226 1241 } 1227 1242 -
trunk/src/VBox/Frontends/VBoxShell/vboxshell.py
r32531 r33061 297 297 exec cmds 298 298 299 def printMouseEvent(ctx, mev): 300 print "Mouse: x=%d y=%d z=%d" %(mev.x, mev.y, mev.z) 301 302 def printKbdEvent(ctx, kev): 303 print "Kbd: ", ctx['global'].getArray(kev, 'scancodes') 304 299 305 def monitorSource(ctx, es, active, dur): 300 306 def handleEventImpl(ev): … … 317 323 else: 318 324 print "pointer shape event: w=%d h=%d shape len=%d" %(psev.width, psev.height, len(shape)) 325 elif type == ctx['global'].constants.VBoxEventType_OnGuestMouseEvent: 326 mev = ctx['global'].queryInterface(ev, 'IGuestMouseEvent') 327 if mev: 328 printMouseEvent(ctx, mev) 329 elif type == ctx['global'].constants.VBoxEventType_OnGuestKeyboardEvent: 330 kev = ctx['global'].queryInterface(ev, 'IGuestKeyboardEvent') 331 if kev: 332 printKbdEvent(ctx, kev) 319 333 320 334 class EventListener: … … 1345 1359 return 0 1346 1360 1361 def monitorGuestKbdCmd(ctx, args): 1362 if (len(args) < 2): 1363 print "usage: monitorGuestKbd name (duration)" 1364 return 0 1365 mach = argsToMach(ctx,args) 1366 if mach == None: 1367 return 0 1368 dur = 5 1369 if len(args) > 2: 1370 dur = float(args[2]) 1371 active = False 1372 cmdExistingVm(ctx, mach, 'guestlambda', [lambda ctx,mach,console,args: monitorSource(ctx, console.keyboard.eventSource, active, dur)]) 1373 return 0 1374 1375 def monitorGuestMouseCmd(ctx, args): 1376 if (len(args) < 2): 1377 print "usage: monitorGuestMouse name (duration)" 1378 return 0 1379 mach = argsToMach(ctx,args) 1380 if mach == None: 1381 return 0 1382 dur = 5 1383 if len(args) > 2: 1384 dur = float(args[2]) 1385 active = False 1386 cmdExistingVm(ctx, mach, 'guestlambda', [lambda ctx,mach,console,args: monitorSource(ctx, console.mouse.eventSource, active, dur)]) 1387 return 0 1347 1388 1348 1389 def monitorVBoxCmd(ctx, args): … … 2825 2866 'guest':['Execute command for guest: guest Win32 \'console.mouse.putMouseEvent(20, 20, 0, 0, 0)\'', guestCmd, 0], 2826 2867 'monitorGuest':['Monitor what happens with the guest for some time: monitorGuest Win32 10', monitorGuestCmd, 0], 2868 'monitorGuestKbd':['Monitor guest keyboardfor some time: monitorGuestKbd Win32 10', monitorGuestKbdCmd, 0], 2869 'monitorGuestMouse':['Monitor guest keyboardfor some time: monitorGuestMouse Win32 10', monitorGuestMouseCmd, 0], 2827 2870 'monitorVBox':['Monitor what happens with Virtual Box for some time: monitorVBox 10', monitorVBoxCmd, 0], 2828 2871 'portForward':['Setup permanent port forwarding for a VM, takes adapter number host port and guest port: portForward Win32 0 8080 80', portForwardCmd, 0], -
trunk/src/VBox/Main/KeyboardImpl.cpp
r32718 r33061 111 111 unconst(mParent) = aParent; 112 112 113 unconst(mEventSource).createObject(); 114 HRESULT rc = mEventSource->init(static_cast<IKeyboard*>(this)); 115 AssertComRCReturnRC(rc); 116 113 117 /* Confirm a successful initialization */ 114 118 autoInitSpan.setSucceeded(); … … 141 145 142 146 unconst(mParent) = NULL; 147 unconst(mEventSource).setNull(); 143 148 } 144 149 … … 238 243 if (codesStored) 239 244 *codesStored = (uint32_t)keys.size(); 245 #if 1 246 VBoxEventDesc evDesc; 247 evDesc.init(mEventSource, VBoxEventType_OnGuestKeyboardEvent, 248 #ifdef RT_OS_WINDOWS 249 scancodes 250 #else 251 scancodesSize, scancodes 252 #endif 253 ); 254 evDesc.fire(0); 255 #endif 240 256 241 257 return rc; … … 261 277 262 278 return PutScancodes(ComSafeArrayAsInParam(cadSequence), NULL); 279 } 280 281 STDMETHODIMP Keyboard::COMGETTER(EventSource)(IEventSource ** aEventSource) 282 { 283 CheckComArgOutPointerValid(aEventSource); 284 285 AutoCaller autoCaller(this); 286 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 287 288 // no need to lock - lifetime constant 289 mEventSource.queryInterfaceTo(aEventSource); 290 291 return S_OK; 263 292 } 264 293 -
trunk/src/VBox/Main/MouseImpl.cpp
r32851 r33061 110 110 unconst(mParent) = parent; 111 111 112 #ifndef VBOXBFE_WITHOUT_COM 113 unconst(mEventSource).createObject(); 114 HRESULT rc = mEventSource->init(static_cast<IMouse*>(this)); 115 AssertComRCReturnRC(rc); 116 mMouseEvent.init(mEventSource, VBoxEventType_OnGuestMouseEvent, 117 0, 0, 0, 0, 0); 118 #endif 119 112 120 mfHostCaps = 0; 113 121 … … 141 149 mParent = NULL; 142 150 #else 151 mMouseEvent.uninit(); 152 unconst(mEventSource).setNull(); 143 153 unconst(mParent) = NULL; 144 154 #endif … … 277 287 } 278 288 289 #ifndef VBOXBFE_WITHOUT_COM 290 STDMETHODIMP Mouse::COMGETTER(EventSource)(IEventSource ** aEventSource) 291 { 292 CheckComArgOutPointerValid(aEventSource); 293 294 AutoCaller autoCaller(this); 295 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 296 297 // no need to lock - lifetime constant 298 mEventSource.queryInterfaceTo(aEventSource); 299 300 return S_OK; 301 } 302 #endif 279 303 280 304 /** … … 309 333 vrc); 310 334 mLastButtons = fButtons; 335 #ifndef VBOXBFE_WITHOUT_COM 336 #if 1 337 mMouseEvent.reinit(VBoxEventType_OnGuestMouseEvent, dx, dy, dz, dw, fButtons); 338 mMouseEvent.fire(0); 339 #endif 340 #endif 311 341 } 312 342 return S_OK; -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r32885 r33061 3623 3623 <attribute name="CPUExecutionCap" type="unsigned long"> 3624 3624 <desc> 3625 Means to limit the number of CPU cycles a guest can use. The unit 3626 is percentage of host CPU cycles per second. The valid range 3625 Means to limit the number of CPU cycles a guest can use. The unit 3626 is percentage of host CPU cycles per second. The valid range 3627 3627 is 1 - 100. 100 (the default) implies no limit. 3628 3628 </desc> … … 10247 10247 <interface 10248 10248 name="IKeyboard" extends="$unknown" 10249 uuid=" 2d1a531b-4c6e-49cc-8af6-5c857b78b5d7"10249 uuid="f6916ec5-a881-4237-898f-7de58cf88672" 10250 10250 wsmap="managed" 10251 10251 > … … 10292 10292 </desc> 10293 10293 </method> 10294 10295 <attribute name="eventSource" type="IEventSource" readonly="yes"> 10296 <desc> 10297 Event source for keyboard events. 10298 </desc> 10299 </attribute> 10294 10300 10295 10301 </interface> … … 10321 10327 <interface 10322 10328 name="IMouse" extends="$unknown" 10323 uuid=" 7c0f2eae-f92d-498c-b802-e1a3763774dc"10329 uuid="05044a52-7811-4f00-ae3a-0ab7ff707b10" 10324 10330 wsmap="managed" 10325 10331 > … … 10486 10492 </param> 10487 10493 </method> 10494 10495 <attribute name="eventSource" type="IEventSource" readonly="yes"> 10496 <desc> 10497 Event source for mouse events. 10498 </desc> 10499 </attribute> 10488 10500 10489 10501 </interface> … … 13934 13946 <enum 13935 13947 name="VBoxEventType" 13936 uuid=" d00980f3-bfcb-4e7d-a20e-08cabf3eb89f">13948 uuid="1728bb3b-4843-4f12-af67-f7a1f69f3a52"> 13937 13949 13938 13950 <desc> … … 14151 14163 </desc> 14152 14164 </const> 14165 <const name="OnGuestKeyboardEvent" value="64"> 14166 <desc> 14167 See <link to="IGuestKeyboardEvent">IGuestKeyboardEvent</link>. 14168 </desc> 14169 </const> 14170 <const name="OnGuestMouseEvent" value="65"> 14171 <desc> 14172 See <link to="IGuestMouseEvent">IGuestMouseEvent</link>. 14173 </desc> 14174 </const> 14153 14175 <!-- Last event marker --> 14154 <const name="Last" value="6 4">14176 <const name="Last" value="66"> 14155 14177 <desc> 14156 14178 Must be last event, used for iterations and structures relying on numerical event values. … … 14868 14890 </interface> 14869 14891 14870 14892 <interface 14871 14893 name="ICPUChangedEvent" extends="IEvent" 14872 14894 uuid="D0F0BECC-EE17-4D17-A8CC-383B0EB55E9D" … … 14902 14924 </attribute> 14903 14925 </interface> 14926 14927 <interface 14928 name="IGuestKeyboardEvent" extends="IEvent" 14929 uuid="88394258-7006-40d4-b339-472ee3801844" 14930 wsmap="managed" autogen="VBoxEvent" id="OnGuestKeyboardEvent" 14931 > 14932 <desc> 14933 Notification when guest keyboard event happens. 14934 </desc> 14935 <attribute name="scancodes" type="long" safearray="yes" readonly="yes"> 14936 <desc> 14937 Array of scancodes. 14938 </desc> 14939 </attribute> 14940 </interface> 14941 14942 <interface 14943 name="IGuestMouseEvent" extends="IReusableEvent" 14944 uuid="2ab6f43c-a111-4520-be63-5d560e8eb463" 14945 wsmap="managed" autogen="VBoxEvent" id="OnGuestMouseEvent" 14946 > 14947 <desc> 14948 Notification when guest mouse event happens. 14949 </desc> 14950 14951 <attribute name="x" type="long" readonly="yes"> 14952 <desc> 14953 New X position. 14954 </desc> 14955 </attribute> 14956 14957 <attribute name="y" type="long" readonly="yes"> 14958 <desc> 14959 New Y position. 14960 </desc> 14961 </attribute> 14962 14963 <attribute name="z" type="long" readonly="yes"> 14964 <desc> 14965 New Z position. 14966 </desc> 14967 </attribute> 14968 14969 <attribute name="w" type="long" readonly="yes"> 14970 <desc> 14971 New W position. 14972 </desc> 14973 </attribute> 14974 14975 <attribute name="buttons" type="long" readonly="yes"> 14976 <desc> 14977 Button state bitmask. 14978 </desc> 14979 </attribute> 14980 14981 </interface> 14982 14904 14983 14905 14984 <interface -
trunk/src/VBox/Main/include/KeyboardImpl.h
r30764 r33061 21 21 #include "VirtualBoxBase.h" 22 22 #include "ConsoleEvents.h" 23 #include "EventImpl.h" 23 24 24 25 #include <VBox/pdmdrv.h> … … 76 77 STDMETHOD(PutCAD)(); 77 78 79 STDMETHOD(COMGETTER(EventSource)) (IEventSource ** aEventSource); 80 78 81 static const PDMDRVREG DrvReg; 79 82 … … 97 100 /** Set after the first attempt to find the VMM Device. */ 98 101 bool mfVMMDevInited; 102 103 const ComObjPtr<EventSource> mEventSource; 99 104 }; 100 105 -
trunk/src/VBox/Main/include/MouseImpl.h
r32829 r33061 22 22 #include "ConsoleEvents.h" 23 23 #include "ConsoleImpl.h" 24 #ifndef VBOXBFE_WITHOUT_COM 25 #include "EventImpl.h" 26 #endif 24 27 #include <VBox/pdmdrv.h> 25 28 … … 68 71 STDMETHOD(PutMouseEventAbsolute)(LONG x, LONG y, LONG dz, LONG dw, 69 72 LONG buttonState); 73 #ifndef VBOXBFE_WITHOUT_COM 74 STDMETHOD(COMGETTER(EventSource)) (IEventSource ** aEventSource); 75 #endif 70 76 71 77 static const PDMDRVREG DrvReg; … … 125 131 uint32_t mLastAbsY; 126 132 uint32_t mLastButtons; 133 134 #ifndef VBOXBFE_WITHOUT_COM 135 const ComObjPtr<EventSource> mEventSource; 136 VBoxEventDesc mMouseEvent; 137 #endif 127 138 }; 128 139
Note:
See TracChangeset
for help on using the changeset viewer.