VirtualBox

Changeset 50683 in vbox


Ignore:
Timestamp:
Mar 4, 2014 5:13:55 PM (11 years ago)
Author:
vboxsync
Message:

HID LEDs sync: return old behavior when new LEDs sync is OFF.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
5 edited

Legend:

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

    r45374 r50683  
    9696            }
    9797        }
    98 #ifdef Q_WS_MAC
    9998        else if (vboxGlobal().isVMConsoleProcess())
    10099        {
     100            /* Take care about HID LEDs sync */
     101            if (strKey == GUI_HidLedsSync)
     102            {
     103                /* If extra data GUI/HidLedsSync is not present in VM config or set
     104                 * to 1 then sync is enabled. Otherwise, it is disabled. */
     105                bool f = (strValue.isEmpty() || strValue == "1") ? true : false;
     106                emit sigHidLedsSyncStateChanged(f);
     107            }
     108
     109#ifdef Q_WS_MAC
    101110            /* Check for the currently running machine */
    102111            if (strId == vboxGlobal().managedVMUuid())
     
    109118                }
    110119            }
     120#endif /* Q_WS_MAC */
    111121        }
    112 #endif /* Q_WS_MAC */
    113122    }
    114123
     
    118127    void sigSelectorShortcutsChanged();
    119128    void sigMachineShortcutsChanged();
     129    void sigHidLedsSyncStateChanged(bool fEnabled);
    120130#ifdef RT_OS_DARWIN
    121131    void sigPresentationModeChange(bool fEnabled);
     
    191201            Qt::QueuedConnection);
    192202
     203    connect(m_pHandler, SIGNAL(sigHidLedsSyncStateChanged(bool)),
     204            this, SIGNAL(sigHidLedsSyncStateChanged(bool)),
     205            Qt::QueuedConnection);
     206
    193207#ifdef Q_WS_MAC
    194208    connect(m_pHandler, SIGNAL(sigPresentationModeChange(bool)),
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIExtraDataEventHandler.h

    r45374 r50683  
    3939    void sigSelectorShortcutsChanged();
    4040    void sigMachineShortcutsChanged();
     41    void sigHidLedsSyncStateChanged(bool fEnabled);
    4142#ifdef RT_OS_DARWIN
    4243    void sigPresentationModeChange(bool fEnabled);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp

    r50191 r50683  
    12141214    {
    12151215        /* Check if the guest has the same view on the modifier keys
    1216          * (NumLock, CapsLock, ScrollLock) as the X server.
    1217          * If not, send KeyPress events to synchronize the state: */
    1218 #if !defined(Q_WS_MAC) && !defined(Q_WS_WIN)
    1219         if (fFlags & KeyPressed)
    1220             fixModifierState(pCodes, puCodesCount);
     1216         * (NumLock, CapsLock, ScrollLock) as the X server. */
     1217#if !defined(Q_WS_MAC)
     1218        /* If there is no HID LEDs sync enabled or supported
     1219         * we should re-sync keyboard LEDs and state following this way. */
     1220        if (!machineLogic()->isHidLedsSyncEnabled())
     1221            if (fFlags & KeyPressed)
     1222                fixModifierState(pCodes, puCodesCount);
    12211223#endif
    12221224
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r50631 r50683  
    5656#include "UIModalWindowManager.h"
    5757#include "UIMedium.h"
     58#include "UIExtraDataEventHandler.h"
    5859#ifdef Q_WS_MAC
    5960# include "DockIconPreview.h"
     
    535536}
    536537
     538void UIMachineLogic::sltHidLedsSyncStateChanged(bool fEnabled)
     539{
     540    m_isHidLedsSyncEnabled = fEnabled;
     541}
     542
    537543void UIMachineLogic::sltKeyboardLedsChanged()
    538544{
     
    647653#endif /* Q_WS_MAC */
    648654    , m_pHostLedsState(NULL)
    649 {
     655    , m_isHidLedsSyncEnabled(false)
     656{
     657    /* Setup HID LEDs synchronization. */
     658#if defined(Q_WS_MAC) || defined(Q_WS_WIN)
     659    /* Read initial extradata value. */
     660    QString strHidLedsSyncSettings = session().GetMachine().GetExtraData(GUI_HidLedsSync);
     661
     662    /* If extra data GUI/HidLedsSync is not present in VM config or set
     663     * to 1 then sync is enabled. Otherwise, it is disabled. */
     664    if (strHidLedsSyncSettings.isEmpty() || strHidLedsSyncSettings == "1")
     665        m_isHidLedsSyncEnabled = true;
     666    else
     667        m_isHidLedsSyncEnabled = false;
     668
     669    /* Subscribe to GUI_HidLedsSync extradata changes in order to
     670     * be able to enable or disable feature dynamically. */
     671    connect(gEDataEvents, SIGNAL(sigHidLedsSyncStateChanged(bool)), this, SLOT(sltHidLedsSyncStateChanged(bool)));
     672#else
     673    m_isHidLedsSyncEnabled = false;
     674#endif
    650675}
    651676
     
    718743            pAction->setText(gpConverter->toString(pAction->data().value<KDragAndDropMode>()));
    719744    }
    720 }
    721 
    722 bool UIMachineLogic::isHidLedsSyncEnabled()
    723 {
    724     /** If extra data GUI/HidLedsSync is not present in VM config or set to 1 then sync is enabled. Otherwise, it is disabled. */
    725     QString strHidLedsSyncSettings = session().GetMachine().GetExtraData(GUI_HidLedsSync);
    726     if (strHidLedsSyncSettings.isEmpty() || strHidLedsSyncSettings == "1")
    727         return true;
    728 
    729     return false;
    730745}
    731746
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h

    r50490 r50683  
    9999
    100100    /** Performs HID LEDs sync. */
    101     bool isHidLedsSyncEnabled();
     101    bool isHidLedsSyncEnabled() { return m_isHidLedsSyncEnabled; };
    102102
    103103protected slots:
     
    245245
    246246    /* Handlers: Keyboard LEDs sync logic: */
     247    void sltHidLedsSyncStateChanged(bool fEnabled);
    247248    void sltSwitchKeyboardLedsToGuestLeds();
    248249    void sltSwitchKeyboardLedsToPreviousLeds();
     
    290291
    291292    void *m_pHostLedsState;
     293    bool m_isHidLedsSyncEnabled;
    292294
    293295    /* Friend classes: */
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