VirtualBox

Ignore:
Timestamp:
Feb 23, 2010 11:24:40 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
57934
Message:

FE/Qt4: new VM core: make it build on OSX again

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxUtils-darwin.cpp

    r22813 r26699  
    148148    return 0;
    149149#endif /* QT_MAC_USE_COCOA */
     150}
     151
     152bool darwinSetFrontMostProcess()
     153{
     154    ProcessSerialNumber psn = { 0, kCurrentProcess };
     155    return ::SetFrontProcess(&psn) == 0;
     156}
     157
     158uint64_t darwinGetCurrentProcessId()
     159{
     160    uint64_t processId = 0;
     161    ProcessSerialNumber psn = { 0, kCurrentProcess };
     162    if (::GetCurrentProcess(&psn) == 0)
     163        processId = RT_MAKE_U64(psn.lowLongOfPSN, psn.highLongOfPSN);
     164    return processId;
    150165}
    151166
  • trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxUtils-darwin.h

    r25171 r26699  
    9494int  darwinWindowToolBarHeight (NativeWindowRef aWindow);
    9595float darwinSmallFontSize();
     96bool darwinSetFrontMostProcess();
     97uint64_t darwinGetCurrentProcessId();
    9698
    9799RT_C_DECLS_END
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.h

    r26637 r26699  
    430430#endif
    431431
     432#endif
    432433#if defined (Q_WS_MAC) && defined (VBOX_GUI_USE_QUARTZ2D)
    433434#include <Carbon/Carbon.h>
     
    496497};
    497498#endif /* Q_WS_MAC && VBOX_GUI_USE_QUARTZ2D */
    498 #endif
    499499
    500500#endif // !___UIFrameBuffer_h___
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r26691 r26699  
    741741#ifdef Q_WS_MAC
    742742        /* Update Dock Overlay: */
    743         if (machineWindowWrapper())
    744             machineWindowWrapper()->updateDockOverlay();
    745 #endif
     743        if (   machineWindowWrapper()
     744            && machineWindowWrapper()->machineView())
     745            machineWindowWrapper()->machineView()->updateDockOverlay();
     746#endif /* Q_WS_MAC */
    746747    }
    747748}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp

    r26691 r26699  
    291291    //mVirtualBoxLogo = ::darwinToCGImageRef("VirtualBox_cube_42px.png");
    292292    QString osTypeId = m_console.GetGuest().GetOSTypeId();
    293     mDockIconPreview = new VBoxDockIconPreview(machineWindowWrapper(), vboxGlobal().vmGuestOSTypeIcon (osTypeId));
     293
     294    // TODO_NEW_CORE
     295//    mDockIconPreview = new VBoxDockIconPreview(machineWindowWrapper(), vboxGlobal().vmGuestOSTypeIcon (osTypeId));
    294296
    295297# ifdef QT_MAC_USE_COCOA
     
    419421             * drawing stuff ourself */
    420422            pViewport->setAttribute(Qt::WA_PaintOnScreen);
    421             mFrameBuf =
     423//            mFrameBuf =
    422424#ifdef VBOX_WITH_VIDEOHWACCEL
    423                     mAccelerate2DVideo ? new VBoxOverlayFrameBuffer<VBoxQuartz2DFrameBuffer>(this, &machineWindowWrapper()->session()) :
    424 #endif
    425                     new VBoxQuartz2DFrameBuffer(this);
     425              // TODO_NEW_CORE
     426//                    mAccelerate2DVideo ? new VBoxOverlayFrameBuffer<VBoxQuartz2DFrameBuffer>(this, &machineWindowWrapper()->session()) :
     427#endif
     428//                  new UIFrameBufferQuartz2D(this);
    426429            break;
    427430#endif
     
    582585
    583586#ifdef Q_WS_MAC
    584 void UIMachineLogic::sltChangeDockIconUpdate(const VBoxChangeDockIconUpdateEvent &event)
     587void UIMachineView::sltChangeDockIconUpdate(const VBoxChangeDockIconUpdateEvent &event)
    585588{
    586589    setDockIconEnabled(event.mChanged);
     
    589592
    590593# ifdef QT_MAC_USE_COCOA
    591 void UIMachineLogic::sltChangePresentationMode(const VBoxChangePresentationModeEvent &event)
    592 {
     594void UIMachineView::sltChangePresentationMode(const VBoxChangePresentationModeEvent &event)
     595{
     596    // TODO_NEW_CORE
     597    // this is full screen related
     598#if 0
    593599    if (mIsFullscreen)
    594600    {
     
    607613    else
    608614        SetSystemUIMode(kUIModeNormal, 0);
     615#endif
    609616}
    610617# endif /* QT_MAC_USE_COCOA */
     
    20412048        }
    20422049#elif defined (Q_WS_MAC)
    2043         if (aUniKey && aUniKey [0] && !aUniKey [1])
    2044             processed = processHotKey (QKeySequence (Qt::UNICODE_ACCEL +
    2045                                                      QChar (aUniKey [0]).toUpper().unicode()),
    2046                                        machineWindowWrapper()->menuBar()->actions());
     2050        // TODO_NEW_CORE
     2051//        if (aUniKey && aUniKey [0] && !aUniKey [1])
     2052//            processed = processHotKey (QKeySequence (Qt::UNICODE_ACCEL +
     2053//                                                     QChar (aUniKey [0]).toUpper().unicode()),
     2054//                                       machineWindowWrapper()->menuBar()->actions());
    20472055
    20482056        /* Don't consider the hot key as pressed since the guest never saw
     
    25432551        {
    25442552# if defined (VBOX_GUI_USE_QUARTZ2D)
    2545             if (mode == VBoxDefs::Quartz2DMode)
    2546             {
     2553                // TODO_NEW_CORE
     2554//            if (mode == VBoxDefs::Quartz2DMode)
     2555//            {
    25472556                /* If the render mode is Quartz2D we could use the CGImageRef
    25482557                 * of the framebuffer for the dock icon creation. This saves
    25492558                 * some conversion time. */
    2550                 mDockIconPreview->updateDockPreview (static_cast <VBoxQuartz2DFrameBuffer *> (mFrameBuf)->imageRef());
    2551             }
    2552             else
     2559//                mDockIconPreview->updateDockPreview (static_cast <VBoxQuartz2DFrameBuffer *> (mFrameBuf)->imageRef());
     2560//            }
     2561//            else
    25532562# endif
    25542563                /* In image mode we have to create the image ref out of the
    25552564                 * framebuffer */
    2556                 mDockIconPreview->updateDockPreview (mFrameBuf);
     2565                // TODO_NEW_CORE
     2566//                mDockIconPreview->updateDockPreview (mFrameBuf);
    25572567        }
    25582568    }
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h

    r26691 r26699  
    3636#include "UIMachineDefs.h"
    3737
     38#ifdef Q_WS_MAC
     39# include <CoreFoundation/CFBase.h>
     40#endif /* Q_WS_MAC */
     41
     42/* Local forward declarations */
     43class VBoxChangeDockIconUpdateEvent;
     44class VBoxChangePresentationModeEvent;
     45class VBoxDockIconPreview;
     46
    3847class UIMachineView : public QAbstractScrollArea
    3948{
     
    6675    void setIgnoreGuestResize(bool bIgnore);
    6776    void setMouseIntegrationEnabled(bool bEnabled);
     77
     78#if defined(Q_WS_MAC)
     79    void updateDockIcon();
     80    void updateDockOverlay();
     81    void setDockIconEnabled(bool aOn) { mDockIconEnabled = aOn; };
     82    void setMouseCoalescingEnabled(bool aOn);
     83#endif
    6884
    6985signals:
     
    133149#if defined(Q_WS_WIN32)
    134150    bool winLowKeyboardEvent(UINT msg, const KBDLLHOOKSTRUCT &event);
    135     bool winEvent (MSG *aMsg, long *aResult);
     151    bool winEvent(MSG *aMsg, long *aResult);
    136152#elif defined(Q_WS_PM)
    137     bool pmEvent (QMSG *aMsg);
     153    bool pmEvent(QMSG *aMsg);
    138154#elif defined(Q_WS_X11)
    139     bool x11Event (XEvent *event);
     155    bool x11Event(XEvent *event);
    140156#elif defined(Q_WS_MAC)
    141     bool darwinKeyboardEvent (const void *pvCocoaEvent, EventRef inEvent);
    142     void darwinGrabKeyboardEvents (bool fGrab);
     157    bool darwinKeyboardEvent(const void *pvCocoaEvent, EventRef inEvent);
     158    void darwinGrabKeyboardEvents(bool fGrab);
    143159#endif
    144160#if defined (Q_WS_WIN32)
     
    184200#ifdef VBOX_WITH_VIDEOHWACCEL
    185201    void scrollContentsBy(int dx, int dy);
    186 #endif
    187 #if defined(Q_WS_MAC)
    188     void updateDockIcon();
    189     void updateDockOverlay();
    190     void setDockIconEnabled(bool aOn) { mDockIconEnabled = aOn; };
    191     void setMouseCoalescingEnabled(bool aOn);
    192202#endif
    193203    void onStateChange(KMachineState state);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r26691 r26699  
    3232#include "UIMachineWindow.h"
    3333
     34#include "VBoxUtils.h"
     35
    3436/* Guest mouse pointer shape change event: */
    3537class UIMousePointerShapeChangeEvent : public QEvent
     
    475477            return S_OK;
    476478
    477         ProcessSerialNumber psn = { 0, kCurrentProcess };
    478         OSErr rc = ::SetFrontProcess(&psn);
    479         if (!rc)
     479        if (::darwinSetFrontMostProcess())
    480480            QApplication::postEvent(m_pEventHandler, new UIShowWindowEvent);
    481481        else
     
    484484             * (This is just a precaution should Mac OS X start imposing the same sensible
    485485             * focus stealing restrictions that other window managers implement). */
    486             AssertMsgFailed(("SetFrontProcess -> %#x\n", rc));
    487             if (::GetCurrentProcess(&psn))
    488                 *puWinId = RT_MAKE_U64(psn.lowLongOfPSN, psn.highLongOfPSN);
     486            *puWinId = ::darwinGetCurrentProcessId();
    489487        }
    490488#else
     
    779777             * what. So, I'll just always show & activate the stupid window to
    780778             * make it get out of the dock when the user wishes to show a VM. */
     779#if 0
     780            // TODO_NEW_CORE
    781781            window()->show();
    782782            window()->activateWindow();
     783#endif
    783784            return true;
    784785        }
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp

    r26691 r26699  
    3737#include "UIMachineView.h"
    3838
     39#include "VBoxUtils.h"
     40
    3941UIMachineLogicNormal::UIMachineLogicNormal(QObject *pParent, UISession *pSession, UIActionsPool *pActionsPool)
    4042    : UIMachineLogic(pParent, pSession, pActionsPool, UIVisualStateType_Normal)
     
    115117    /* We have to make sure that we are getting the front most process.
    116118     * This is necessary for Qt versions > 4.3.3: */
    117     ProcessSerialNumber psn = { 0, kCurrentProcess };
    118     ::SetFrontProcess(&psn);
     119    ::darwinSetFrontMostProcess();
    119120#endif /* Q_WS_MAC */
    120121
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette