dogtail keyCombo workaround for typing characters with <Shift> modifier key



Hi,

I'm trying to automate typing from a spice linux client to a guest and I am having issues with getting spice client to recognize capital letters & characters like ( ) # % { }, etc, i.e, characters which would normally require a modifier key. e.g A = <Shift>a; $ = <Shift>4, { = <Shift>[. This is because spice client only recognizes characters on the keyboard pressed directly or with a modifier key => this is how a user would type it manually. 

The way dogtail does keyCombo does not let me do <Shift>4 or <Shift>[ => It bails out with an error message. Dogtail should be able to pass characters with modifier keys as well as the way it does them now. 

Longterm, I feel the rawinput.py module should be rewritten entirely and be more abstract - separate functions for text (also handling modifier keys) and non-printable key combos. Also, it needs more documentation and the user should be able to figure out what to send from the rawinput.py file and the keyCombo function should handle the gtk details.For eg, right now to figure out how to pass a ( => I had to go into gtk.keysyms file to get the correct keycode to pass and it ends up as needing to be keyCombo("<Shift>_9") to type a (. 

For now, I have a workaround for this. Please review and let me know if that's ok. Main change is commenting out lines 200-201 and putting in 202-203. I will file a bug explaining the situation and put this in the code as well to keep track of this issue. 


    200     #code = keyNameToKeyCode(finalKey)
    201     #registry.generateKeyboardEvent(code, None, KEY_PRESSRELEASE)
    202     code = keyNameToKeySym(finalKey)
    203     registry.generateKeyboardEvent(code, None, KEY_SYM)
    204 
    205     for modifier in modifiers:
    206         code = keyNameToKeyCode(modifier)
    207         registry.generateKeyboardEvent(code, None, KEY_RELEASE)
    208 
    209     #doDelay()
    210     doTypingDelay()
  
I have done some testing and previous functionality works well and as well as new functionality. 

Thanks,
- Swapna



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]