VirtualBox

Changeset 30213 in vbox


Ignore:
Timestamp:
Jun 15, 2010 6:19:26 PM (14 years ago)
Author:
vboxsync
Message:

FE/Qt: New running VM core: move some common code into UIMachineWindow class.

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

Legend:

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

    r29926 r30213  
    4141#include "UIMachineWindowFullscreen.h"
    4242#include "UIMachineWindowSeamless.h"
     43
     44#ifdef Q_WS_X11
     45# include <X11/Xlib.h>
     46#endif
    4347
    4448UIMachineWindow* UIMachineWindow::create(UIMachineLogic *pMachineLogic, UIVisualStateType visualStateType, ulong uScreenId)
     
    144148    updateAppearanceOf(UIVisualElement_WindowCaption);
    145149}
     150
     151#ifdef Q_WS_X11
     152bool UIMachineWindow::x11Event(XEvent *pEvent)
     153{
     154    // TODO: Check if that is still required!
     155    /* Qt bug: when the machine-view grabs the keyboard,
     156     * FocusIn, FocusOut, WindowActivate and WindowDeactivate Qt events are
     157     * not properly sent on top level window deactivation.
     158     * The fix is to substiute the mode in FocusOut X11 event structure
     159     * to NotifyNormal to cause Qt to process it as desired. */
     160    if (pEvent->type == FocusOut)
     161    {
     162        if (pEvent->xfocus.mode == NotifyWhileGrabbed  &&
     163            (pEvent->xfocus.detail == NotifyAncestor ||
     164             pEvent->xfocus.detail == NotifyInferior ||
     165             pEvent->xfocus.detail == NotifyNonlinear))
     166        {
     167             pEvent->xfocus.mode = NotifyNormal;
     168        }
     169    }
     170    return false;
     171}
     172#endif
    146173
    147174void UIMachineWindow::closeEvent(QCloseEvent *pEvent)
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h

    r28800 r30213  
    7070
    7171    /* Common machine window event handlers: */
     72#ifdef Q_WS_X11
     73    bool x11Event(XEvent *pEvent);
     74#endif
    7275    void closeEvent(QCloseEvent *pEvent);
    7376
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp

    r29133 r30213  
    147147bool UIMachineWindowFullscreen::x11Event(XEvent *pEvent)
    148148{
    149     /* Qt bug: when the console view grabs the keyboard, FocusIn, FocusOut,
    150      * WindowActivate and WindowDeactivate Qt events are not properly sent
    151      * on top level window (i.e. this) deactivation. The fix is to substiute
    152      * the mode in FocusOut X11 event structure to NotifyNormal to cause
    153      * Qt to process it as desired. */
    154     if (pEvent->type == FocusOut)
    155     {
    156         if (pEvent->xfocus.mode == NotifyWhileGrabbed  &&
    157             (pEvent->xfocus.detail == NotifyAncestor ||
    158              pEvent->xfocus.detail == NotifyInferior ||
    159              pEvent->xfocus.detail == NotifyNonlinear))
    160         {
    161              pEvent->xfocus.mode = NotifyNormal;
    162         }
    163     }
    164     return false;
     149    return UIMachineWindow::x11Event(pEvent);
    165150}
    166151#endif
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.h

    r28800 r30213  
    2626#include "QIWithRetranslateUI.h"
    2727#include "UIMachineWindow.h"
    28 #ifdef Q_WS_X11
    29 # include <X11/Xlib.h>
    30 #endif
    3128
    3229/* Local forwards */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp

    r30014 r30213  
    319319bool UIMachineWindowNormal::x11Event(XEvent *pEvent)
    320320{
    321     /* Qt bug: when the console view grabs the keyboard, FocusIn, FocusOut,
    322      * WindowActivate and WindowDeactivate Qt events are not properly sent
    323      * on top level window (i.e. this) deactivation. The fix is to substiute
    324      * the mode in FocusOut X11 event structure to NotifyNormal to cause
    325      * Qt to process it as desired. */
    326     if (pEvent->type == FocusOut)
    327     {
    328         if (pEvent->xfocus.mode == NotifyWhileGrabbed  &&
    329             (pEvent->xfocus.detail == NotifyAncestor ||
    330              pEvent->xfocus.detail == NotifyInferior ||
    331              pEvent->xfocus.detail == NotifyNonlinear))
    332         {
    333              pEvent->xfocus.mode = NotifyNormal;
    334         }
    335     }
    336     return false;
     321    return UIMachineWindow::x11Event(pEvent);
    337322}
    338323#endif
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.h

    r28800 r30213  
    2828#include "QIWithRetranslateUI.h"
    2929#include "UIMachineWindow.h"
    30 #ifdef Q_WS_X11
    31 # include <X11/Xlib.h>
    32 #endif
    3330
    3431/* Local forwards */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp

    r29133 r30213  
    176176bool UIMachineWindowSeamless::x11Event(XEvent *pEvent)
    177177{
    178     /* Qt bug: when the console view grabs the keyboard, FocusIn, FocusOut,
    179      * WindowActivate and WindowDeactivate Qt events are not properly sent
    180      * on top level window (i.e. this) deactivation. The fix is to substiute
    181      * the mode in FocusOut X11 event structure to NotifyNormal to cause
    182      * Qt to process it as desired. */
    183     if (pEvent->type == FocusOut)
    184     {
    185         if (pEvent->xfocus.mode == NotifyWhileGrabbed  &&
    186             (pEvent->xfocus.detail == NotifyAncestor ||
    187              pEvent->xfocus.detail == NotifyInferior ||
    188              pEvent->xfocus.detail == NotifyNonlinear))
    189         {
    190              pEvent->xfocus.mode = NotifyNormal;
    191         }
    192     }
    193     return false;
     178    return UIMachineWindow::x11Event(pEvent);
    194179}
    195180#endif
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.h

    r28964 r30213  
    2626#include "QIWithRetranslateUI.h"
    2727#include "UIMachineWindow.h"
    28 #ifdef Q_WS_X11
    29 # include <X11/Xlib.h>
    30 #endif
    3128
    3229/* Local forwards */
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