VirtualBox

Changeset 33061 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Oct 12, 2010 12:42:20 PM (14 years ago)
Author:
vboxsync
Message:

Main, vboxshell: implemented support for user activity capturing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxShell/vboxshell.py

    r32531 r33061  
    297297    exec cmds
    298298
     299def printMouseEvent(ctx, mev):
     300    print "Mouse: x=%d y=%d z=%d" %(mev.x, mev.y, mev.z)
     301
     302def printKbdEvent(ctx, kev):
     303    print "Kbd: ", ctx['global'].getArray(kev, 'scancodes')
     304
    299305def monitorSource(ctx, es, active, dur):
    300306    def handleEventImpl(ev):
     
    317323                 else:
    318324                     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)
    319333
    320334    class EventListener:
     
    13451359    return 0
    13461360
     1361def 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
     1375def 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
    13471388
    13481389def monitorVBoxCmd(ctx, args):
     
    28252866            'guest':['Execute command for guest: guest Win32 \'console.mouse.putMouseEvent(20, 20, 0, 0, 0)\'', guestCmd, 0],
    28262867            '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],
    28272870            'monitorVBox':['Monitor what happens with Virtual Box for some time: monitorVBox 10', monitorVBoxCmd, 0],
    28282871            'portForward':['Setup permanent port forwarding for a VM, takes adapter number host port and guest port: portForward Win32 0 8080 80', portForwardCmd, 0],
Note: See TracChangeset for help on using the changeset viewer.

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