VirtualBox

Changeset 14527 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Nov 24, 2008 4:04:15 PM (16 years ago)
Author:
vboxsync
Message:

Main-OSX: added initial power change notification

Location:
trunk/src/VBox/Main
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/HostImpl.cpp

    r14523 r14527  
    190190#if defined (RT_OS_WINDOWS)
    191191    mHostPowerService = new HostPowerServiceWin (mParent);
     192#elif defined (RT_OS_DARWIN)
     193    mHostPowerService = new HostPowerServiceDarwin (mParent);
    192194#else
    193195    mHostPowerService = new HostPowerService (mParent);
  • trunk/src/VBox/Main/Makefile.kmk

    r14485 r14527  
    294294
    295295VBoxSVC_SOURCES.darwin = \
    296         darwin/iokit.cpp
     296        darwin/iokit.cpp \
     297        darwin/HostPowerDarwin.cpp
    297298
    298299VBoxSVC_SOURCES.win = \
  • trunk/src/VBox/Main/include/HostPower.h

    r13713 r14527  
    55
    66/*
    7  * Copyright (C) 2006-2007 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2008 Sun Microsystems, Inc.
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2727
    2828#include <vector>
     29
     30#ifdef RT_OS_DARWIN
     31# include <IOKit/pwr_mgt/IOPMLib.h>
     32# include <Carbon/Carbon.h>
     33#endif /* RT_OS_DARWIN */
    2934
    3035class VirtualBox;
     
    7277    RTTHREAD    mThread;
    7378};
    74 # endif /* RT_OS_WINDOWS */
     79# elif defined(RT_OS_DARWIN) /* RT_OS_WINDOWS */
     80/**
     81 * The Darwin hosted Power Service.
     82 */
     83class HostPowerServiceDarwin : public HostPowerService
     84{
     85public:
     86
     87    HostPowerServiceDarwin (VirtualBox *aVirtualBox);
     88    virtual ~HostPowerServiceDarwin();
     89
     90private:
     91
     92    static DECLCALLBACK(int) powerChangeNotificationThread (RTTHREAD ThreadSelf, void *pInstance);
     93    static void powerChangeNotificationHandler (void *pData, io_service_t service, natural_t messageType, void *pMessageArgument);
     94    static OSErr lowPowerEventHandler (const AppleEvent * theAppleEvent, AppleEvent * replyAppleEvent, long refCon);
     95
     96    /* Private member vars */
     97    RTTHREAD mThread; /* Our message thread. */
     98
     99    io_connect_t mRootPort; /* A reference to the Root Power Domain IOService */
     100    IONotificationPortRef mNotifyPort; /* Notification port allocated by IORegisterForSystemPower */
     101    io_object_t mNotifierObject; /* Notifier object, used to deregister later */
     102    CFRunLoopRef mRunLoop; /* A reference to the local thread run loop */
     103};
     104# endif /* RT_OS_DARWIN */
    75105
    76106#endif /* !____H_HOSTPOWER */
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