VirtualBox

Ignore:
Timestamp:
Jun 25, 2013 12:37:57 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
86706
Message:

Main/Host(HostPower)+Session+Console: convert HostPower code to signal pause/resume/savestate through internal methods, conveying information why the method was called, preparing for VM/PDM passing this information to devices and drivers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/win/HostPowerWin.cpp

    r46722 r46775  
    55
    66/*
    7  * Copyright (C) 2006-2010 Oracle Corporation
     7 * Copyright (C) 2006-2013 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    3636    mHwnd = 0;
    3737
    38     int rc = RTThreadCreate (&mThread, HostPowerServiceWin::NotificationThread, this, 65536,
    39                              RTTHREADTYPE_GUI, RTTHREADFLAGS_WAITABLE, "MainPower");
     38    int rc = RTThreadCreate(&mThread, HostPowerServiceWin::NotificationThread, this, 65536,
     39                            RTTHREADTYPE_GUI, RTTHREADFLAGS_WAITABLE, "MainPower");
    4040
    4141    if (RT_FAILURE(rc))
     
    6363
    6464
    65 DECLCALLBACK(int) HostPowerServiceWin::NotificationThread (RTTHREAD ThreadSelf, void *pInstance)
     65DECLCALLBACK(int) HostPowerServiceWin::NotificationThread(RTTHREAD ThreadSelf, void *pInstance)
    6666{
    6767    HostPowerServiceWin *pPowerObj = (HostPowerServiceWin *)pInstance;
     
    7171    int rc = VINF_SUCCESS;
    7272
    73     HINSTANCE hInstance = (HINSTANCE)GetModuleHandle (NULL);
     73    HINSTANCE hInstance = (HINSTANCE)GetModuleHandle(NULL);
    7474
    7575    /* Register the Window Class. */
     
    9797    {
    9898        /* Create the window. */
    99         hwnd = pPowerObj->mHwnd = CreateWindowEx (WS_EX_TOOLWINDOW | WS_EX_TRANSPARENT | WS_EX_TOPMOST,
    100                                                   gachWindowClassName, gachWindowClassName,
    101                                                   WS_POPUPWINDOW,
    102                                                  -200, -200, 100, 100, NULL, NULL, hInstance, NULL);
     99        hwnd = pPowerObj->mHwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TRANSPARENT | WS_EX_TOPMOST,
     100                                                 gachWindowClassName, gachWindowClassName,
     101                                                 WS_POPUPWINDOW,
     102                                                -200, -200, 100, 100, NULL, NULL, hInstance, NULL);
    103103
    104104        if (hwnd == NULL)
     
    124124    Log(("HostPowerServiceWin::NotificationThread: exit thread\n"));
    125125    if (hwnd)
    126         DestroyWindow (hwnd);
     126        DestroyWindow(hwnd);
    127127
    128128    if (atomWindowClass != 0)
    129129    {
    130         UnregisterClass (gachWindowClassName, hInstance);
     130        UnregisterClass(gachWindowClassName, hInstance);
    131131        atomWindowClass = 0;
    132132    }
     
    149149                {
    150150                case PBT_APMSUSPEND:
    151                     pPowerObj->notify(HostPowerEvent_Suspend);
     151                    pPowerObj->notify(Reason_HostSuspend);
    152152                    break;
    153153
    154154                case PBT_APMRESUMEAUTOMATIC:
    155                     pPowerObj->notify(HostPowerEvent_Resume);
     155                    pPowerObj->notify(Reason_HostResume);
    156156                    break;
    157157
     
    180180                                    &&  BatteryState.EstimatedTime < 60*5)
    181181                                {
    182                                     pPowerObj->notify(HostPowerEvent_BatteryLow);
     182                                    pPowerObj->notify(Reason_HostBatteryLow);
    183183                                }
    184184                            }
     
    187187                            if (SystemPowerStatus.BatteryFlag == 4      /* critical battery status; less than 5% */)
    188188                            {
    189                                 pPowerObj->notify(HostPowerEvent_BatteryLow);
     189                                pPowerObj->notify(Reason_HostBatteryLow);
    190190                            }
    191191                        }
     
    194194                }
    195195                default:
    196                     return DefWindowProc (hwnd, msg, wParam, lParam);
     196                    return DefWindowProc(hwnd, msg, wParam, lParam);
    197197                }
    198198            }
     
    201201
    202202        default:
    203             return DefWindowProc (hwnd, msg, wParam, lParam);
    204     }
    205 }
     203            return DefWindowProc(hwnd, msg, wParam, lParam);
     204    }
     205}
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