VirtualBox

Changeset 102018 in vbox


Ignore:
Timestamp:
Nov 9, 2023 11:19:23 AM (16 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
160118
Message:

GUI: Introduce guest notifcation about VM window input focus state changes, bugref:10194.

This is a temporary shortcut solution which uses guest property in order to notify guest.
Later it needs to be replaced with corresponding (newly introduced) API call.

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

Legend:

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

    r101719 r102018  
    707707{
    708708    return uisession()->acquireGuestAdditionsRevision(uRevision);
     709}
     710
     711bool UIMachine::notifyGuiFocusChange(bool fInfocus)
     712{
     713    return uisession()->notifyGuiFocusChange(fInfocus);
    709714}
    710715
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h

    r101719 r102018  
    417417        /** Acquires the guest addition's revision. */
    418418        bool acquireGuestAdditionsRevision(ulong &uRevision);
     419        /** Notifies guest about VM window focus changes. */
     420        bool notifyGuiFocusChange(bool fInfocus);
    419421    /** @} */
    420422
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r101719 r102018  
    14891489                    sltSwitchKeyboardLedsToGuestLeds();
    14901490#endif /* !VBOX_WS_WIN */
     1491
     1492                    /* Notify guest about VM window now has input focus. */
     1493                    if (!uimachine()->notifyGuiFocusChange(true))
     1494                        LogRel(("GUI: Cannot notify guest about VM window in-focus event\n"));
    14911495                    break;
    14921496                }
     
    14961500                    /* We should restore lock states to *previous* known: */
    14971501                    sltSwitchKeyboardLedsToPreviousLeds();
     1502
     1503                    /* Notify guest about VM window has lost input focus. */
     1504                    if (!uimachine()->notifyGuiFocusChange(false))
     1505                        LogRel(("GUI: Cannot notify guest about VM window out-of-focus event\n"));
    14981506                    break;
    14991507                }
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r101719 r102018  
    9090#endif
    9191
     92#include <VBox/GuestHost/clipboard-helper.h>
     93
    9294/* VirtualBox interface declarations: */
    9395#include <VBox/com/VirtualBox.h>
     
    13601362        uRevision = uGARevision;
    13611363    return fSuccess;
     1364}
     1365
     1366bool UISession::notifyGuiFocusChange(bool fInfocus)
     1367{
     1368    CMachine comMachine = machine();
     1369    comMachine.SetGuestProperty(VBOX_GUI_FOCUS_CHANGE_GUEST_PROP_NAME, fInfocus ? "1" : "0", "RDONLYGUEST,TRANSIENT");
     1370    return comMachine.isOk();
    13621371}
    13631372
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r101719 r102018  
    404404        /** Acquires the guest addition's revision. */
    405405        bool acquireGuestAdditionsRevision(ulong &uRevision);
     406        /** Notifies GAs about VM window focus changes. */
     407        bool notifyGuiFocusChange(bool fInfocus);
    406408    /** @} */
    407409
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