VirtualBox

Changeset 59657 in vbox


Ignore:
Timestamp:
Feb 12, 2016 2:08:05 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: Qt5 migration (part 88): Implementing keyboard handling for Qt5: Watch for keyboard hook view index on all platforms (previously for Mac and Win only).

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime
Files:
2 edited

Legend:

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

    r59656 r59657  
    14101410    , m_fPassCADtoGuest(false)
    14111411    , m_fDebuggerActive(false)
     1412    , m_iKeyboardHookViewIndex(-1)
    14121413#if defined(Q_WS_MAC)
    1413     , m_iKeyboardHookViewIndex(-1)
    14141414    , m_uDarwinKeyModifiers(0)
    14151415#elif defined(Q_WS_WIN)
    1416     , m_iKeyboardHookViewIndex(-1)
    14171416    , m_fIsHostkeyInCapture(false)
    14181417    , m_fSkipKeyboardEvents(false)
     
    14811480        UICocoaApplication::instance()->unregisterForNativeEvents(RT_BIT_32(10) | RT_BIT_32(11) | RT_BIT_32(12) /* NSKeyDown  | NSKeyUp | | NSFlagsChanged */,
    14821481                                                                  UIKeyboardHandler::macKeyboardProc, this);
    1483         /* Update the id: */
    1484         m_iKeyboardHookViewIndex = -1;
    14851482    }
    14861483
     
    14911488    m_pAltGrMonitor = 0;
    14921489
    1493     /* Cleanup keyboard-hook: */
     1490    /* If keyboard-hook is installed: */
    14941491    if (m_keyboardHook)
    14951492    {
    14961493        /* Uninstall existing keyboard-hook: */
    1497         ::UnhookWindowsHookEx(m_keyboardHook);
    1498         m_keyboardHook = NULL;
    1499         /* Update the id: */
    1500         m_iKeyboardHookViewIndex = -1;
     1494        UnhookWindowsHookEx(m_keyboardHook);
     1495        m_keyboardHook = 0;
    15011496    }
    15021497
    15031498#endif /* Q_WS_WIN */
     1499
     1500    /* Update keyboard hook view index: */
     1501    m_iKeyboardHookViewIndex = -1;
    15041502}
    15051503
     
    15651563                        ::DarwinGrabKeyboard(false);
    15661564                    }
    1567                     /* Update the id: */
    1568                     m_iKeyboardHookViewIndex = uScreenId;
    15691565                }
    15701566
     
    15851581                    m_keyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL, UIKeyboardHandler::winKeyboardProc, GetModuleHandle(NULL), 0);
    15861582                    AssertMsg(m_keyboardHook, ("SetWindowsHookEx(): err=%d", GetLastError()));
    1587                     /* Update the id: */
    1588                     m_iKeyboardHookViewIndex = uScreenId;
    15891583                }
    15901584
    15911585#endif /* Q_WS_WIN */
     1586
     1587                /* Update keyboard hook view index: */
     1588                m_iKeyboardHookViewIndex = uScreenId;
    15921589
    15931590                if (isSessionRunning())
     
    16051602                        setAutoCaptureDisabled(false);
    16061603                }
     1604
    16071605                break;
    16081606            }
     
    16181616                    UICocoaApplication::instance()->unregisterForNativeEvents(RT_BIT_32(10) | RT_BIT_32(11) | RT_BIT_32(12) /* NSKeyDown  | NSKeyUp | | NSFlagsChanged */,
    16191617                                                                              UIKeyboardHandler::macKeyboardProc, this);
    1620                     /* Update the id: */
    1621                     m_iKeyboardHookViewIndex = -1;
    16221618                }
    16231619
     
    16301626                    UnhookWindowsHookEx(m_keyboardHook);
    16311627                    m_keyboardHook = 0;
    1632                     /* Update the id: */
    1633                     m_iKeyboardHookViewIndex = -1;
    16341628                }
    16351629
    16361630#endif /* Q_WS_WIN */
     1631
     1632                /* Update keyboard hook view index: */
     1633                m_iKeyboardHookViewIndex = -1;
    16371634
    16381635                /* Release keyboard: */
     
    16411638                /* And all pressed keys: */
    16421639                releaseAllPressedKeys(true);
     1640
    16431641                break;
    16441642            }
     
    16801678                        popupCenter().remindAboutPausedVMInput(machineLogic()->activeMachineWindow());
    16811679                }
     1680
    16821681                break;
    16831682            }
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.h

    r59656 r59657  
    212212    bool m_fDebuggerActive : 1;
    213213
    214 #if defined(Q_WS_MAC)
    215214    /** Holds the keyboard hook view index. */
    216215    int m_iKeyboardHookViewIndex;
    217     /** Holds the current modifiers key mask. */
     216
     217#if defined(Q_WS_MAC)
     218    /** Mac: Holds the current modifiers key mask. */
    218219    UInt32 m_uDarwinKeyModifiers;
    219220#elif defined(Q_WS_WIN)
    220     /** Holds the keyboard hook view index. */
    221     int m_iKeyboardHookViewIndex;
    222     /* Currently this is used in winKeyboardEvent() only: */
     221    /** Win: Currently this is used in winKeyboardEvent() only. */
    223222    bool m_fIsHostkeyInCapture;
    224     /** Holds whether the keyboard event filter should ignore keyboard events. */
     223    /** Win: Holds whether the keyboard event filter should ignore keyboard events. */
    225224    bool m_fSkipKeyboardEvents;
    226     /** Holds the keyboard hook instance. */
     225    /** Win: Holds the keyboard hook instance. */
    227226    HHOOK m_keyboardHook;
    228     /** Holds the object monitoring key event stream for problematic AltGr events. */
     227    /** Win: Holds the object monitoring key event stream for problematic AltGr events. */
    229228    WinAltGrMonitor *m_pAltGrMonitor;
    230     /** Holds the keyboard handler reference to be accessible from the keyboard hook. */
     229    /** Win: Holds the keyboard handler reference to be accessible from the keyboard hook. */
    231230    static UIKeyboardHandler *m_spKeyboardHandler;
    232231#endif /* Q_WS_WIN */
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