Changeset 33295 in vbox for trunk/src/VBox/Frontends/VBoxShell
- Timestamp:
- Oct 21, 2010 10:46:46 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxShell/vboxshell.py
r33266 r33295 405 405 listener = console.eventSource.createListener() 406 406 registered = False 407 sources = [console.keyboard.eventSource, console.mouse.eventSource] 407 # we create an aggregated event source to listen for multiple event types 408 agg = console.eventSource.createAggregator([console.keyboard.eventSource, console.mouse.eventSource]) 408 409 demo = open(file, 'w') 409 410 header="VM="+console.machine.name+"\n" … … 413 414 dur = 100000 414 415 try: 415 for es in sources: 416 es.registerListener(listener, [ctx['global'].constants.VBoxEventType_Any], False) 416 agg.registerListener(listener, [ctx['global'].constants.VBoxEventType_Any], False) 417 417 registered = True 418 418 end = time.time() + dur 419 419 while time.time() < end: 420 for es in sources: 421 ev = es.getEvent(listener, 0) 422 if ev: 423 handleEventImpl(ev) 424 # keyboard/mouse events aren't waitable, so no need for eventProcessed 420 ev = agg.getEvent(listener, 0) 421 if ev: 422 handleEventImpl(ev) 423 # keyboard/mouse events aren't waitable, so no need for eventProcessed 425 424 # We need to catch all exceptions here, otherwise listener will never be unregistered 426 425 except: … … 429 428 demo.close() 430 429 if listener and registered: 431 for es in sources: 432 es.unregisterListener(listener) 430 agg.unregisterListener(listener) 433 431 434 432
Note:
See TracChangeset
for help on using the changeset viewer.