VirtualBox

Changeset 2378 in vbox


Ignore:
Timestamp:
Apr 27, 2007 2:49:26 AM (18 years ago)
Author:
vboxsync
Message:

Fixed 2-3 host key issues on darwin.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp

    r2348 r2378  
    699699            vboxProblem().cannotResumeMachine (cconsole);
    700700    }
    701 #ifdef Q_WS_MAC /* A quick hack to prevent getting the typing-while-paused on Host-Q. */
    702     else if (on)
    703         darwinGrabKeyboardEvents (false);
    704 #endif
    705701
    706702    return ok;
     
    14061402            AssertCompileSize (wchar_t, 2);
    14071403            AssertCompileSize (UniChar, 2);
    1408             wchar_t ucs[32];
     1404            UInt32 cbWritten = 0;
     1405            wchar_t ucs[8];
    14091406            if (::GetEventParameter (inEvent, kEventParamKeyUnicodes, typeUnicodeText, NULL,
    1410                                      sizeof (ucs), NULL, &ucs[0]) != 0)
    1411                 ucs[0] = 0;
     1407                                     sizeof (ucs), &cbWritten, &ucs[0]) != 0)
     1408                cbWritten = 0;
     1409            ucs[cbWritten / sizeof(wchar_t)] = 0; /* The api doesn't terminate it. */
    14121410
    14131411            ret = keyEvent (keyCode, scanCode, flags, ucs[0] ? ucs : NULL);
     
    14221420        newMask = ::DarwinAdjustModifierMask (newMask);
    14231421        UInt32 changed = newMask ^ m_darwinKeyModifiers;
    1424         ret = kbd_captured;
    14251422        if (changed)
    14261423        {
     
    14491446                        flags |= KeyExtended;
    14501447                    scanCode &= VBOXKEY_SCANCODE_MASK;
    1451                     ret |= keyEvent (keyCode, scanCode, flags | KeyPressed);
    1452                     ret |= keyEvent (keyCode, scanCode, flags);
     1448                    keyEvent (keyCode, scanCode, flags | KeyPressed);
     1449                    keyEvent (keyCode, scanCode, flags);
    14531450                }
    14541451            }
     
    14561453
    14571454        m_darwinKeyModifiers = newMask;
     1455
     1456        /* Always return true here because we'll otherwise getting a Qt event
     1457           we don't want and that will only cause the Pause warning to pop up. */
     1458        ret = true;
    14581459    }
    14591460
     
    16661667    LONG *codes = buf;
    16671668    uint count = 0;
     1669    uint8_t what_pressed = 0;
    16681670
    16691671    if (!is_hostkey)
     
    17011703
    17021704            // process the scancode and update the table of pressed keys
    1703             uint8_t what_pressed = IsKeyPressed;
     1705            what_pressed = IsKeyPressed;
    17041706
    17051707            if (flags & KeyExtended)
     
    18461848        }
    18471849#elif defined (Q_WS_MAC)
    1848         if (aUniKey && aUniKey[0] && !aUniKey[1])
     1850        if (aUniKey && aUniKey [0] && !aUniKey [1])
    18491851            processed = processHotKey (QKeySequence (UNICODE_ACCEL +
    1850                                             QChar (aUniKey [0]).upper().unicode()),
     1852                                                     QChar (aUniKey [0]).upper().unicode()),
    18511853                                       mainwnd->menuBar());
    1852 #endif
     1854
     1855        /* Don't consider the hot key as pressed since the guest never saw it. (probably a generic thing) */
     1856        keys_pressed [scan] &= ~what_pressed;
     1857#endif
     1858
    18531859        // grab the key from Qt if processed, or pass it to Qt otherwise
    18541860        // in order to process non-alphanumeric keys in event(), after they are
     
    18741880
    18751881//    LogFlow (("*** Putting scan codes: "));
    1876 //    for (int i = 0; i < count; i++)
     1882//    for (unsigned i = 0; i < count; i++)
    18771883//        LogFlow (("%02x ", codes [i]));
    18781884//    LogFlow (("\n"));
     
    22802286    if (capture)
    22812287    {
    2282 # if 0
    2283         ::DarwinReleaseKeyboard ();
    2284         ::DarwinGrabKeyboard (true);
    2285 # else
    22862288        ::DarwinDisableGlobalHotKeys (true);
    2287 # endif
    22882289        grabKeyboard();
    22892290    }
    22902291    else
    22912292    {
    2292 # if 0
    2293         ::DarwinReleaseKeyboard ();
    2294         ::DarwinGrabKeyboard (false);
    2295 # else
    22962293        ::DarwinDisableGlobalHotKeys (false);
    2297 # endif
    22982294        releaseKeyboard();
    22992295    }
     
    24272423    // Note, that it's just a guess that sending RESEND will give the desired
    24282424    // effect :), but at least it works with NT and W2k guests.
     2425    /** @todo This seems to causes linux guests (in console mode) to cough a bit.
     2426     * We need to check if this is the cause of #1944 and/or #1949. --bird */
    24292427    codes [0] = 0xFE;
    24302428    keyboard.PutScancodes (codes, 1);
     
    24452443    if (release_hostkey)
    24462444        hostkey_pressed = false;
     2445
     2446#ifdef Q_WS_MAC
     2447    /* clear most of the modifiers. */
     2448    m_darwinKeyModifiers &= alphaLock | kEventKeyModifierNumLockMask
     2449                          | (release_hostkey ? 0 : ::DarwinKeyCodeToDarwinModifierMask (gs.hostKey()));
     2450#endif
    24472451
    24482452    emitKeyboardStateChanged ();
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