[Top][All Lists]

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

Re: [Qemu-devel] [PATCH v2 1/2] ui/cocoa.m: move ungrab to ctrl-alt-g

From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH v2 1/2] ui/cocoa.m: move ungrab to ctrl-alt-g
Date: Thu, 2 Nov 2017 16:09:05 +0000

On 2 November 2017 at 15:20, Programmingkid <address@hidden> wrote:
>> On Nov 2, 2017, at 5:10 AM, Peter Maydell <address@hidden> wrote:
>> Testing this I have found that it makes the grab key be
>> "ctrl+alt+ the key labelled 'g'", even if in the
>> OSX host keyboard mapping that key doesn't produce the
>> letter 'g'. This is in contrast to for instance the menu
>> accelerators which honour the host keyboard layout, and
>> it's also not what the GTK UI does. So I think we need
>> to fix that.
> I just realized that the cocoa interface does not consider the keyboard 
> layout. Switching from QWERTY to DVORK I still see the same keys outputting 
> the same characters in OpenBIOS. This is a separate patch but sometime to 
> take note.

There's a difference between "what do we send to the guest"
(where we're obliged to send raw keycodes, but the user can
configure their guest with an appropriate keymap if they like)
and "what do we do as part of the QEMU UI" (where there is
no ability for the user to set a keymap and we should honour
the host UI keymap settings).

If you look at the behaviour of other VM implementations
like Parallels I think you'll find it's the same.

I think the way we need to implement this is that instead
of doing "switch (keycode)" and looking for Q_KEY_CODE_1...
we should do something like

if (ctrl and alt pressed) {
    NSString *keychar = [theEvent charactersIgnoringModifiers];
    if ([keychar length] == 1) {
        switch ([keychar characterAtIndex:0]) {
        case '1' .. '9':
        case 'g':
            /* handle ungrab */

as suggested by:

-- PMM

reply via email to

[Prev in Thread] Current Thread [Next in Thread]