VirtualBox

Ignore:
Timestamp:
Aug 19, 2013 4:34:02 PM (11 years ago)
Author:
vboxsync
Message:

Main: API event for multitouch input.

File:
1 edited

Legend:

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

    r47804 r47848  
    312312def printKbdEvent(ctx, kev):
    313313    print "Kbd: ", ctx['global'].getArray(kev, 'scancodes')
     314
     315def printMultiTouchEvent(ctx, mtev):
     316    print "MultiTouch : contacts=%d time=%d" % (mtev.contactCount, mtev.scanTime)
     317    xPositions = ctx['global'].getArray(mtev, 'xPositions')
     318    yPositions = ctx['global'].getArray(mtev, 'yPositions')
     319    contactIds = ctx['global'].getArray(mtev, 'contactIds')
     320    contactFlags = ctx['global'].getArray(mtev, 'contactFlags')
     321
     322    for i in range(0, mtev.contactCount):
     323        print "  [%d] %d,%d %d %d" % (i, xPositions[i], yPositions[i], contactIds[i], contactFlags[i])
    314324
    315325def monitorSource(ctx, eventSource, active, dur):
     
    341351            if kev:
    342352                printKbdEvent(ctx, kev)
     353        elif evtype == ctx['global'].constants.VBoxEventType_OnGuestMultiTouch:
     354            mtev = ctx['global'].queryInterface(event, 'IGuestMultiTouchEvent')
     355            if mtev:
     356                printMultiTouchEvent(ctx, mtev)
    343357
    344358    class EventListener:
     
    15611575    if (len(args) < 2):
    15621576        print "usage: monitorGuestMouse name (duration)"
     1577        return 0
     1578    mach = argsToMach(ctx, args)
     1579    if mach == None:
     1580        return 0
     1581    dur = 5
     1582    if len(args) > 2:
     1583        dur = float(args[2])
     1584    active = False
     1585    cmdExistingVm(ctx, mach, 'guestlambda', [lambda ctx, mach, console, args:  monitorSource(ctx, console.mouse.eventSource, active, dur)])
     1586    return 0
     1587
     1588def monitorGuestMultiTouchCmd(ctx, args):
     1589    if (len(args) < 2):
     1590        print "usage: monitorGuestMultiTouch name (duration)"
    15631591        return 0
    15641592    mach = argsToMach(ctx, args)
     
    32203248            'guest':['Execute command for guest: guest Win32 \'console.mouse.putMouseEvent(20, 20, 0, 0, 0)\'', guestCmd, 0],
    32213249            'monitorGuest':['Monitor what happens with the guest for some time: monitorGuest Win32 10', monitorGuestCmd, 0],
    3222             'monitorGuestKbd':['Monitor guest keyboardfor some time: monitorGuestKbd Win32 10', monitorGuestKbdCmd, 0],
    3223             'monitorGuestMouse':['Monitor guest keyboardfor some time: monitorGuestMouse Win32 10', monitorGuestMouseCmd, 0],
     3250            'monitorGuestKbd':['Monitor guest keyboard for some time: monitorGuestKbd Win32 10', monitorGuestKbdCmd, 0],
     3251            'monitorGuestMouse':['Monitor guest mouse for some time: monitorGuestMouse Win32 10', monitorGuestMouseCmd, 0],
     3252            'monitorGuestMultiTouch':['Monitor guest touch screen for some time: monitorGuestMultiTouch Win32 10', monitorGuestMultiTouchCmd, 0],
    32243253            'monitorVBox':['Monitor what happens with Virtual Box for some time: monitorVBox 10', monitorVBoxCmd, 0],
    32253254            '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