mirror of
https://github.com/reactos/reactos.git
synced 2025-04-06 05:34:22 +00:00
[POWERCFG] Do not re-initialize all paged directly when the hibernate file setting changes. Re-initialize the pages on PSN_SETACTIVE instead.
This commit is contained in:
parent
bd7b0c96c6
commit
cc13842ad4
3 changed files with 49 additions and 57 deletions
|
@ -11,8 +11,6 @@
|
|||
|
||||
#include "powercfg.h"
|
||||
|
||||
HWND hAdv = 0;
|
||||
|
||||
static POWER_ACTION g_SystemBatteries[3];
|
||||
static POWER_ACTION g_PowerButton[5];
|
||||
static POWER_ACTION g_SleepButton[5];
|
||||
|
@ -52,7 +50,7 @@ AddItem(HWND hDlgCtrl, INT ResourceId, LPARAM lParam, POWER_ACTION * lpAction)
|
|||
|
||||
if (LoadString(hApplet, ResourceId, szBuffer, MAX_PATH) < MAX_PATH)
|
||||
{
|
||||
Index = SendMessage(hDlgCtrl, CB_ADDSTRING, 0, (LPARAM)szBuffer);
|
||||
Index = SendMessage(hDlgCtrl, CB_INSERTSTRING, -1, (LPARAM)szBuffer);
|
||||
if (Index != CB_ERR)
|
||||
{
|
||||
SendMessage(hDlgCtrl, CB_SETITEMDATA, (WPARAM)Index, lParam);
|
||||
|
@ -298,7 +296,8 @@ ShowCurrentPowerActionPolicies(HWND hwndDlg)
|
|||
}
|
||||
|
||||
VOID
|
||||
Adv_InitDialog(VOID)
|
||||
Adv_InitDialog(
|
||||
HWND hwndDlg)
|
||||
{
|
||||
HWND hList1;
|
||||
HWND hList2;
|
||||
|
@ -318,13 +317,13 @@ Adv_InitDialog(VOID)
|
|||
else
|
||||
gGPP.user.GlobalFlags &= ~EnableSysTrayBatteryMeter;
|
||||
|
||||
CheckDlgButton(hAdv,
|
||||
CheckDlgButton(hwndDlg,
|
||||
IDC_SYSTRAYBATTERYMETER,
|
||||
bEnabled ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(hAdv,
|
||||
CheckDlgButton(hwndDlg,
|
||||
IDC_PASSWORDLOGON,
|
||||
gGPP.user.GlobalFlags & EnablePasswordLogon ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(hAdv,
|
||||
CheckDlgButton(hwndDlg,
|
||||
IDC_VIDEODIMDISPLAY,
|
||||
gGPP.user.GlobalFlags & EnableVideoDimDisplay ? BST_CHECKED : BST_UNCHECKED);
|
||||
|
||||
|
@ -336,7 +335,7 @@ Adv_InitDialog(VOID)
|
|||
bHibernate = spc.HiberFilePresent;
|
||||
bShutdown = spc.SystemS5;
|
||||
|
||||
hList1 = GetDlgItem(hAdv, IDC_LIDCLOSE);
|
||||
hList1 = GetDlgItem(hwndDlg, IDC_LIDCLOSE);
|
||||
SendMessage(hList1, CB_RESETCONTENT, 0, 0);
|
||||
|
||||
memset(g_SystemBatteries, 0x0, sizeof(g_SystemBatteries));
|
||||
|
@ -356,12 +355,12 @@ Adv_InitDialog(VOID)
|
|||
}
|
||||
else
|
||||
{
|
||||
ShowWindow(GetDlgItem(hAdv, IDC_VIDEODIMDISPLAY), FALSE);
|
||||
ShowWindow(GetDlgItem(hAdv, IDC_SLIDCLOSE), FALSE);
|
||||
ShowWindow(GetDlgItem(hwndDlg, IDC_VIDEODIMDISPLAY), FALSE);
|
||||
ShowWindow(GetDlgItem(hwndDlg, IDC_SLIDCLOSE), FALSE);
|
||||
ShowWindow(hList1, FALSE);
|
||||
}
|
||||
|
||||
hList2 = GetDlgItem(hAdv, IDC_POWERBUTTON);
|
||||
hList2 = GetDlgItem(hwndDlg, IDC_POWERBUTTON);
|
||||
SendMessage(hList2, CB_RESETCONTENT, 0, 0);
|
||||
|
||||
memset(g_PowerButton, 0x0, sizeof(g_PowerButton));
|
||||
|
@ -387,11 +386,11 @@ Adv_InitDialog(VOID)
|
|||
}
|
||||
else
|
||||
{
|
||||
ShowWindow(GetDlgItem(hAdv, IDC_SPOWERBUTTON), FALSE);
|
||||
ShowWindow(GetDlgItem(hwndDlg, IDC_SPOWERBUTTON), FALSE);
|
||||
ShowWindow(hList2, FALSE);
|
||||
}
|
||||
|
||||
hList3 = GetDlgItem(hAdv, IDC_SLEEPBUTTON);
|
||||
hList3 = GetDlgItem(hwndDlg, IDC_SLEEPBUTTON);
|
||||
SendMessage(hList3, CB_RESETCONTENT, 0, 0);
|
||||
memset(g_SleepButton, 0x0, sizeof(g_SleepButton));
|
||||
|
||||
|
@ -417,13 +416,13 @@ Adv_InitDialog(VOID)
|
|||
}
|
||||
else
|
||||
{
|
||||
ShowWindow(GetDlgItem(hAdv, IDC_SSLEEPBUTTON), FALSE);
|
||||
ShowWindow(GetDlgItem(hwndDlg, IDC_SSLEEPBUTTON), FALSE);
|
||||
ShowWindow(hList3, FALSE);
|
||||
}
|
||||
|
||||
if (ReadGlobalPwrPolicy(&gGPP))
|
||||
{
|
||||
ShowCurrentPowerActionPolicies(hAdv);
|
||||
ShowCurrentPowerActionPolicies(hwndDlg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -490,17 +489,17 @@ Adv_SaveData(HWND hwndDlg)
|
|||
|
||||
if (!IsBatteryUsed())
|
||||
{
|
||||
SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_POWERBUTTON), &gGPP.user.PowerButtonAc);
|
||||
#if 0
|
||||
SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_LIDCLOSE), &gGPP.user.LidCloseAc);
|
||||
SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_SLEEPBUTTON), &gGPP.user.SleepButtonAc);
|
||||
#endif
|
||||
SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_POWERBUTTON), &gGPP.user.PowerButtonAc);
|
||||
SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_SLEEPBUTTON), &gGPP.user.SleepButtonAc);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if 0
|
||||
SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_POWERBUTTON), &gGPP.user.PowerButtonDc);
|
||||
SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_LIDCLOSE), &gGPP.user.LidCloseDc);
|
||||
SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_POWERBUTTON), &gGPP.user.PowerButtonDc);
|
||||
SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_SLEEPBUTTON), &gGPP.user.SleepButtonDc);
|
||||
#endif
|
||||
}
|
||||
|
@ -512,7 +511,7 @@ Adv_SaveData(HWND hwndDlg)
|
|||
|
||||
SetSystrayPowerIconState(bSystrayBatteryMeter);
|
||||
|
||||
Adv_InitDialog();
|
||||
// Adv_InitDialog(hwndDlg);
|
||||
}
|
||||
|
||||
/* Property page dialog callback */
|
||||
|
@ -525,8 +524,7 @@ AdvancedDlgProc(HWND hwndDlg,
|
|||
switch (uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
hAdv = hwndDlg;
|
||||
Adv_InitDialog();
|
||||
Adv_InitDialog(hwndDlg);
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
|
@ -553,14 +551,17 @@ AdvancedDlgProc(HWND hwndDlg,
|
|||
break;
|
||||
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
LPNMHDR lpnm = (LPNMHDR)lParam;
|
||||
if (lpnm->code == (UINT)PSN_APPLY)
|
||||
switch (((LPNMHDR)lParam)->code)
|
||||
{
|
||||
Adv_SaveData(hwndDlg);
|
||||
case PSN_APPLY:
|
||||
Adv_SaveData(hwndDlg);
|
||||
return TRUE;
|
||||
|
||||
case PSN_SETACTIVE:
|
||||
Adv_InitDialog(hwndDlg);
|
||||
return TRUE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
|
|
@ -11,10 +11,6 @@
|
|||
|
||||
#include "powercfg.h"
|
||||
|
||||
//BOOLEAN Pos_InitData();
|
||||
//void Adv_InitDialog();
|
||||
|
||||
|
||||
static VOID
|
||||
Hib_InitDialog(HWND hwndDlg)
|
||||
{
|
||||
|
@ -75,9 +71,6 @@ Hib_SaveData(HWND hwndDlg)
|
|||
|
||||
if (CallNtPowerInformation(SystemReserveHiberFile, &bHibernate, sizeof(bHibernate), NULL, 0) == STATUS_SUCCESS)
|
||||
{
|
||||
// FIXME: Do not call these functions directly! Post a message to the other pages instead!
|
||||
// Pos_InitData();
|
||||
// Adv_InitDialog();
|
||||
Hib_InitDialog(hwndDlg);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -111,13 +104,11 @@ HibernateDlgProc(HWND hwndDlg,
|
|||
break;
|
||||
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
LPNMHDR lpnm = (LPNMHDR)lParam;
|
||||
if (lpnm->code == (UINT)PSN_APPLY)
|
||||
if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY)
|
||||
{
|
||||
return Hib_SaveData(hwndDlg);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
|
|
@ -276,23 +276,21 @@ Pos_InitData(
|
|||
ShowWindow(GetDlgItem(hwndDlg, IDC_SDC), SW_HIDE);
|
||||
ShowWindow(GetDlgItem(hwndDlg, IDC_MONITORDCLIST), SW_HIDE);
|
||||
ShowWindow(GetDlgItem(hwndDlg, IDC_DISKDCLIST), SW_HIDE);
|
||||
ShowWindow(GetDlgItem(hwndDlg, IDC_STANDBYDCLIST), SW_HIDE);
|
||||
ShowWindow(GetDlgItem(hwndDlg, IDC_HIBERNATEDCLIST), SW_HIDE);
|
||||
}
|
||||
|
||||
if (!(spc.SystemS1 || spc.SystemS2 || spc.SystemS3))
|
||||
{
|
||||
ShowWindow(GetDlgItem(hwndDlg, IDC_STANDBY), SW_HIDE);
|
||||
ShowWindow(GetDlgItem(hwndDlg, IDC_STANDBYACLIST), SW_HIDE);
|
||||
ShowWindow(GetDlgItem(hwndDlg, IDC_STANDBYDCLIST), SW_HIDE);
|
||||
}
|
||||
ShowWindow(GetDlgItem(hwndDlg, IDC_STANDBY),
|
||||
(spc.SystemS1 || spc.SystemS2 || spc.SystemS3) ? SW_SHOW : SW_HIDE);
|
||||
ShowWindow(GetDlgItem(hwndDlg, IDC_STANDBYACLIST),
|
||||
(spc.SystemS1 || spc.SystemS2 || spc.SystemS3) ? SW_SHOW : SW_HIDE);
|
||||
ShowWindow(GetDlgItem(hwndDlg, IDC_STANDBYDCLIST),
|
||||
((spc.SystemS1 || spc.SystemS2 || spc.SystemS3) && spc.SystemBatteriesPresent) ? SW_SHOW : SW_HIDE);
|
||||
|
||||
if (!spc.HiberFilePresent)
|
||||
{
|
||||
ShowWindow(GetDlgItem(hwndDlg, IDC_HIBERNATE), SW_HIDE);
|
||||
ShowWindow(GetDlgItem(hwndDlg, IDC_HIBERNATEACLIST), SW_HIDE);
|
||||
ShowWindow(GetDlgItem(hwndDlg, IDC_HIBERNATEDCLIST), SW_HIDE);
|
||||
}
|
||||
ShowWindow(GetDlgItem(hwndDlg, IDC_HIBERNATE),
|
||||
(spc.HiberFilePresent) ? SW_SHOW : SW_HIDE);
|
||||
ShowWindow(GetDlgItem(hwndDlg, IDC_HIBERNATEACLIST),
|
||||
(spc.HiberFilePresent) ? SW_SHOW : SW_HIDE);
|
||||
ShowWindow(GetDlgItem(hwndDlg, IDC_HIBERNATEDCLIST),
|
||||
(spc.HiberFilePresent && spc.SystemBatteriesPresent) ? SW_SHOW : SW_HIDE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -955,13 +953,15 @@ PowerSchemesDlgProc(
|
|||
break;
|
||||
|
||||
case WM_NOTIFY:
|
||||
switch (((LPNMHDR)lParam)->code)
|
||||
{
|
||||
LPNMHDR lpnm = (LPNMHDR)lParam;
|
||||
if (lpnm->code == (UINT)PSN_APPLY)
|
||||
{
|
||||
case PSN_APPLY:
|
||||
Pos_SaveData(hwndDlg, pPageData);
|
||||
}
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
|
||||
case PSN_SETACTIVE:
|
||||
Pos_InitData(hwndDlg);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue