mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
[INPUT] Implement advanced settings (#5864)
Allow the user to turn off "Advanced Text Service". [HKEY_CURRENT_USER\Software\Microsoft\CTF] "Disable Thread Input Manager"=dword:00000001 Implement AdvancedSettingsPageProc procedure. Modify IDS_REBOOT_NOW resource string. CORE-19268
This commit is contained in:
parent
b6a0ef10d2
commit
80c4856bba
29 changed files with 166 additions and 66 deletions
|
@ -3,13 +3,103 @@
|
|||
* FILE: dll/cpl/input/advanced_settings_page.c
|
||||
* PURPOSE: input.dll
|
||||
* PROGRAMMER: Dmitry Chapyshev (dmitry@reactos.org)
|
||||
* Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
|
||||
*/
|
||||
|
||||
#include "input.h"
|
||||
|
||||
BOOL g_bTextServiceIsOff = FALSE;
|
||||
|
||||
BOOL LoadAdvancedSettings(HWND hwndDlg)
|
||||
{
|
||||
HKEY hKey;
|
||||
LRESULT error;
|
||||
DWORD dwType;
|
||||
DWORD dwValue;
|
||||
DWORD cbValue = sizeof(dwValue);
|
||||
|
||||
error = RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\Microsoft\\CTF", 0, KEY_READ, &hKey);
|
||||
if (error != ERROR_SUCCESS)
|
||||
return FALSE;
|
||||
|
||||
error = RegQueryValueExW(hKey,
|
||||
L"Disable Thread Input Manager",
|
||||
NULL,
|
||||
&dwType,
|
||||
(LPBYTE)&dwValue,
|
||||
&cbValue);
|
||||
if ((error != ERROR_SUCCESS) || (dwType != REG_DWORD) || (cbValue != sizeof(dwValue)))
|
||||
dwValue = FALSE; /* Default */
|
||||
|
||||
RegCloseKey(hKey);
|
||||
|
||||
CheckDlgButton(hwndDlg, IDC_TURNOFFTEXTSVCS_CB, (dwValue ? BST_CHECKED : BST_UNCHECKED));
|
||||
g_bTextServiceIsOff = !!dwValue;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL SaveAdvancedSettings(HWND hwndDlg)
|
||||
{
|
||||
HKEY hKey;
|
||||
LRESULT error;
|
||||
const DWORD dwValue = g_bTextServiceIsOff;
|
||||
const DWORD cbValue = sizeof(dwValue);
|
||||
|
||||
error = RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\Microsoft\\CTF", 0, KEY_WRITE, &hKey);
|
||||
if (error != ERROR_SUCCESS)
|
||||
return FALSE;
|
||||
|
||||
error = RegSetValueExW(hKey, L"Disable Thread Input Manager", 0, REG_DWORD,
|
||||
(const BYTE *)&dwValue, cbValue);
|
||||
|
||||
RegCloseKey(hKey);
|
||||
return (error == ERROR_SUCCESS);
|
||||
}
|
||||
|
||||
static INT_PTR OnNotifyAdvancedSettingsPage(HWND hwndDlg, LPARAM lParam)
|
||||
{
|
||||
LPNMHDR header = (LPNMHDR)lParam;
|
||||
|
||||
switch (header->code)
|
||||
{
|
||||
case PSN_APPLY:
|
||||
{
|
||||
BOOL bOff = (IsDlgButtonChecked(hwndDlg, IDC_TURNOFFTEXTSVCS_CB) == BST_CHECKED);
|
||||
g_bRebootNeeded |= (g_bTextServiceIsOff && !bOff);
|
||||
g_bTextServiceIsOff = bOff;
|
||||
|
||||
/* Write advanced settings */
|
||||
SaveAdvancedSettings(hwndDlg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
INT_PTR CALLBACK
|
||||
AdvancedSettingsPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
return FALSE;
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
LoadAdvancedSettings(hwndDlg);
|
||||
return TRUE;
|
||||
|
||||
case WM_NOTIFY:
|
||||
return OnNotifyAdvancedSettingsPage(hwndDlg, lParam);
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDC_TURNOFFTEXTSVCS_CB:
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
static LONG CALLBACK SystemApplet(HWND hwnd, UINT uMsg, LPARAM lParam1, LPARAM lParam2);
|
||||
|
||||
HINSTANCE hApplet = NULL;
|
||||
BOOL g_bRebootNeeded = FALSE;
|
||||
|
||||
/* Applets */
|
||||
static APPLET Applets[NUM_APPLETS] =
|
||||
|
@ -35,19 +36,44 @@ InitPropSheetPage(PROPSHEETPAGEW *page, WORD idDlg, DLGPROC DlgProc)
|
|||
page->pfnDlgProc = DlgProc;
|
||||
}
|
||||
|
||||
static BOOL AskForReboot(HWND hwndDlg)
|
||||
{
|
||||
WCHAR szText[128], szCaption[64];
|
||||
LoadStringW(hApplet, IDS_REBOOT_NOW, szText, _countof(szText));
|
||||
LoadStringW(hApplet, IDS_LANGUAGE, szCaption, _countof(szCaption));
|
||||
return (MessageBoxW(hwndDlg, szText, szCaption, MB_ICONINFORMATION | MB_YESNO) == IDYES);
|
||||
}
|
||||
|
||||
static int CALLBACK
|
||||
PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
|
||||
{
|
||||
// NOTE: This callback is needed to set large icon correctly.
|
||||
HICON hIcon;
|
||||
switch (uMsg)
|
||||
{
|
||||
case PSCB_INITIALIZED:
|
||||
{
|
||||
hIcon = LoadIconW(hApplet, MAKEINTRESOURCEW(IDI_CPLSYSTEM));
|
||||
/* Set large icon correctly */
|
||||
HICON hIcon = LoadIconW(hApplet, MAKEINTRESOURCEW(IDI_CPLSYSTEM));
|
||||
SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
|
||||
break;
|
||||
}
|
||||
|
||||
case PSCB_BUTTONPRESSED:
|
||||
{
|
||||
switch (lParam)
|
||||
{
|
||||
case PSBTN_OK:
|
||||
case PSBTN_APPLYNOW:
|
||||
{
|
||||
if (g_bRebootNeeded && AskForReboot(hwndDlg))
|
||||
{
|
||||
EnableProcessPrivileges(SE_SHUTDOWN_NAME, TRUE);
|
||||
ExitWindowsEx(EWX_REBOOT | EWX_FORCE, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ typedef struct
|
|||
} APPLET, *PAPPLET;
|
||||
|
||||
extern HINSTANCE hApplet;
|
||||
extern BOOL g_bRebootNeeded;
|
||||
|
||||
// Character Count of a layout ID like "00000409"
|
||||
#define CCH_LAYOUT_ID 8
|
||||
|
@ -40,6 +41,7 @@ extern HINSTANCE hApplet;
|
|||
/* settings_page.c */
|
||||
INT_PTR CALLBACK
|
||||
SettingsPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
BOOL EnableProcessPrivileges(LPCWSTR lpPrivilegeName, BOOL bEnable);
|
||||
|
||||
/* advanced_settings_page.c */
|
||||
INT_PTR CALLBACK
|
||||
|
|
|
@ -395,12 +395,28 @@ InputList_Process(VOID)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/* Find change in the IME HKLs */
|
||||
for (pCurrent = _InputList; pCurrent != NULL; pCurrent = pCurrent->pNext)
|
||||
{
|
||||
if (!IS_IME_HKL(pCurrent->hkl))
|
||||
continue;
|
||||
|
||||
if ((pCurrent->wFlags & INPUT_LIST_NODE_FLAG_ADDED) ||
|
||||
(pCurrent->wFlags & INPUT_LIST_NODE_FLAG_EDITED) ||
|
||||
(pCurrent->wFlags & INPUT_LIST_NODE_FLAG_DELETED))
|
||||
{
|
||||
bRet = TRUE; /* Reboot is needed */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Process DELETED and EDITED entries */
|
||||
for (pCurrent = _InputList; pCurrent != NULL; pCurrent = pCurrent->pNext)
|
||||
{
|
||||
if ((pCurrent->wFlags & INPUT_LIST_NODE_FLAG_DELETED) ||
|
||||
(pCurrent->wFlags & INPUT_LIST_NODE_FLAG_EDITED))
|
||||
{
|
||||
|
||||
/* Only unload the DELETED and EDITED entries */
|
||||
if (UnloadKeyboardLayout(pCurrent->hkl))
|
||||
{
|
||||
|
|
|
@ -110,7 +110,7 @@ BEGIN
|
|||
IDS_CTRL_SHIFT "Ctrl+Shift"
|
||||
IDS_LEFT_ALT_SHIFT "Ляв Alt+Shift"
|
||||
IDS_SWITCH_BET_INLANG "Превключване на езиците за въвеждане"
|
||||
IDS_REBOOT_NOW, "Рестартирай сега?"
|
||||
IDS_REBOOT_NOW "You have to restart the system for the settings to take effect. Reboot now?"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
|
|
|
@ -115,7 +115,7 @@ BEGIN
|
|||
IDS_CTRL_SHIFT "Ctrl+Shift"
|
||||
IDS_LEFT_ALT_SHIFT "Levý Alt+Shift"
|
||||
IDS_SWITCH_BET_INLANG "Přepnout mezi vstupními jazyky"
|
||||
IDS_REBOOT_NOW, "Reboot now?"
|
||||
IDS_REBOOT_NOW "You have to restart the system for the settings to take effect. Reboot now?"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
|
|
|
@ -110,7 +110,7 @@ BEGIN
|
|||
IDS_CTRL_SHIFT "Strg+Umschalt"
|
||||
IDS_LEFT_ALT_SHIFT "Alt links+Umschalt"
|
||||
IDS_SWITCH_BET_INLANG "Zwischen Eingabesprachen umschalten"
|
||||
IDS_REBOOT_NOW, "Reboot now?"
|
||||
IDS_REBOOT_NOW "You have to restart the system for the settings to take effect. Reboot now?"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
|
|
|
@ -110,7 +110,7 @@ BEGIN
|
|||
IDS_CTRL_SHIFT "Ctrl+Shift"
|
||||
IDS_LEFT_ALT_SHIFT "Left Alt+Shift"
|
||||
IDS_SWITCH_BET_INLANG "Switch between input languages"
|
||||
IDS_REBOOT_NOW, "Reboot now?"
|
||||
IDS_REBOOT_NOW "You have to restart the system for the settings to take effect. Reboot now?"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
|
|
|
@ -110,7 +110,7 @@ BEGIN
|
|||
IDS_CTRL_SHIFT "Ctrl+Shift"
|
||||
IDS_LEFT_ALT_SHIFT "Left Alt+Shift"
|
||||
IDS_SWITCH_BET_INLANG "Switch between input languages"
|
||||
IDS_REBOOT_NOW, "Reboot now?"
|
||||
IDS_REBOOT_NOW "You have to restart the system for the settings to take effect. Reboot now?"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
|
|
|
@ -119,7 +119,7 @@ BEGIN
|
|||
IDS_CTRL_SHIFT "Ctrl+Mayús"
|
||||
IDS_LEFT_ALT_SHIFT "Alt Izq+Mayús"
|
||||
IDS_SWITCH_BET_INLANG "Cambiar entre los idiomas de entrada"
|
||||
IDS_REBOOT_NOW, "¿Reiniciar ahora?"
|
||||
IDS_REBOOT_NOW "You have to restart the system for the settings to take effect. Reboot now?"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
|
|
|
@ -110,7 +110,7 @@ BEGIN
|
|||
IDS_CTRL_SHIFT "Ctrl+Maj"
|
||||
IDS_LEFT_ALT_SHIFT "Alt Gauche+Maj"
|
||||
IDS_SWITCH_BET_INLANG "Changer les langues de saisie"
|
||||
IDS_REBOOT_NOW, "Redémarrer maintenant ?"
|
||||
IDS_REBOOT_NOW "Il est nécessaire de redémarrer le système afin que les changements prennent effet. Redémarrer maintenant ?"
|
||||
END
|
||||
|
||||
/* FIXME : À améliorer/compléter */
|
||||
|
|
|
@ -112,7 +112,7 @@ BEGIN
|
|||
IDS_CTRL_SHIFT "Ctrl+Shift"
|
||||
IDS_LEFT_ALT_SHIFT "מקש Alt שמאלי+Shift"
|
||||
IDS_SWITCH_BET_INLANG "החלף בין שפות כתיבה"
|
||||
IDS_REBOOT_NOW, "להפעיל מחדש כעת?"
|
||||
IDS_REBOOT_NOW "You have to restart the system for the settings to take effect. Reboot now?"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
|
|
|
@ -110,7 +110,7 @@ BEGIN
|
|||
IDS_CTRL_SHIFT "Ctrl+Shift"
|
||||
IDS_LEFT_ALT_SHIFT "Alt kiri+Shift"
|
||||
IDS_SWITCH_BET_INLANG "Mengganti salah satu bahasa masukan"
|
||||
IDS_REBOOT_NOW, "Mulai ulang sekarang?"
|
||||
IDS_REBOOT_NOW "You have to restart the system for the settings to take effect. Reboot now?"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
|
|
|
@ -110,7 +110,7 @@ BEGIN
|
|||
IDS_CTRL_SHIFT "Ctrl+Shift"
|
||||
IDS_LEFT_ALT_SHIFT "Alt sinistro+Shift"
|
||||
IDS_SWITCH_BET_INLANG "Cambia lingua di digitazione"
|
||||
IDS_REBOOT_NOW, "Reboot now?"
|
||||
IDS_REBOOT_NOW "You have to restart the system for the settings to take effect. Reboot now?"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
|
|
|
@ -110,7 +110,7 @@ BEGIN
|
|||
IDS_CTRL_SHIFT "Ctrl+Shift"
|
||||
IDS_LEFT_ALT_SHIFT "左Alt+Shift"
|
||||
IDS_SWITCH_BET_INLANG "入力言語の切り替え"
|
||||
IDS_REBOOT_NOW, "再起動しますか?"
|
||||
IDS_REBOOT_NOW "設定を有効にするにはシステムを再起動する必要があります。今すぐ再起動しますか?"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
|
|
|
@ -110,7 +110,7 @@ BEGIN
|
|||
IDS_CTRL_SHIFT "Ctrl+Shift"
|
||||
IDS_LEFT_ALT_SHIFT "Venstre Alt+Shift"
|
||||
IDS_SWITCH_BET_INLANG "Bytt mellom inndataspråk"
|
||||
IDS_REBOOT_NOW, "Reboot now?"
|
||||
IDS_REBOOT_NOW "You have to restart the system for the settings to take effect. Reboot now?"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
|
|
|
@ -119,7 +119,7 @@ BEGIN
|
|||
IDS_CTRL_SHIFT "Ctrl+Shift"
|
||||
IDS_LEFT_ALT_SHIFT "Lewy Alt+Shift"
|
||||
IDS_SWITCH_BET_INLANG "Przełącza pomiędzy układami klawiatury"
|
||||
IDS_REBOOT_NOW, "Uruchomić ponownie system?"
|
||||
IDS_REBOOT_NOW "You have to restart the system for the settings to take effect. Reboot now?"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
|
|
|
@ -110,7 +110,7 @@ BEGIN
|
|||
IDS_CTRL_SHIFT "CTRL+SHIFT"
|
||||
IDS_LEFT_ALT_SHIFT "ALT esquerdo+SHIFT"
|
||||
IDS_SWITCH_BET_INLANG "Alternar entre idiomas de entrada"
|
||||
IDS_REBOOT_NOW, "Reboot now?"
|
||||
IDS_REBOOT_NOW "You have to restart the system for the settings to take effect. Reboot now?"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
|
|
|
@ -110,7 +110,7 @@ BEGIN
|
|||
IDS_CTRL_SHIFT "CTRL+SHIFT"
|
||||
IDS_LEFT_ALT_SHIFT "ALT esquerdo+SHIFT"
|
||||
IDS_SWITCH_BET_INLANG "Alternar entre idiomas de entrada"
|
||||
IDS_REBOOT_NOW, "Reiniciar agora?"
|
||||
IDS_REBOOT_NOW "You have to restart the system for the settings to take effect. Reboot now?"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
|
|
|
@ -118,7 +118,7 @@ BEGIN
|
|||
IDS_CTRL_SHIFT "«Ctrl» + «Shift»"
|
||||
IDS_LEFT_ALT_SHIFT "«Alt» (stâng) + «Shift»"
|
||||
IDS_SWITCH_BET_INLANG "Comutarea între limbile de intrare"
|
||||
IDS_REBOOT_NOW, "Reporniți acum?"
|
||||
IDS_REBOOT_NOW "You have to restart the system for the settings to take effect. Reboot now?"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
|
|
|
@ -110,7 +110,7 @@ BEGIN
|
|||
IDS_CTRL_SHIFT "Ctrl+Shift"
|
||||
IDS_LEFT_ALT_SHIFT "Alt слева+Shift"
|
||||
IDS_SWITCH_BET_INLANG "Переключение между языками ввода"
|
||||
IDS_REBOOT_NOW, "Перезагрузить сейчас?"
|
||||
IDS_REBOOT_NOW "You have to restart the system for the settings to take effect. Reboot now?"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
|
|
|
@ -115,7 +115,7 @@ BEGIN
|
|||
IDS_CTRL_SHIFT "Ctrl+Shift"
|
||||
IDS_LEFT_ALT_SHIFT "Ľavý Alt+Shift"
|
||||
IDS_SWITCH_BET_INLANG "Switch between input languages"
|
||||
IDS_REBOOT_NOW, "Reboot now?"
|
||||
IDS_REBOOT_NOW "You have to restart the system for the settings to take effect. Reboot now?"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
|
|
|
@ -114,7 +114,7 @@ BEGIN
|
|||
IDS_CTRL_SHIFT "Ctrl+Shift"
|
||||
IDS_LEFT_ALT_SHIFT "Left Alt+Shift"
|
||||
IDS_SWITCH_BET_INLANG "Ndërro ndër gjuhët hyrese"
|
||||
IDS_REBOOT_NOW, "Reboot now?"
|
||||
IDS_REBOOT_NOW "You have to restart the system for the settings to take effect. Reboot now?"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
|
|
|
@ -112,7 +112,7 @@ BEGIN
|
|||
IDS_CTRL_SHIFT "Ctrl + Shift"
|
||||
IDS_LEFT_ALT_SHIFT "Sol Alt + Shift"
|
||||
IDS_SWITCH_BET_INLANG "Giriş dilleri arasında geçiş yap."
|
||||
IDS_REBOOT_NOW, "Şimdi yeniden başlatılsın mı?"
|
||||
IDS_REBOOT_NOW "You have to restart the system for the settings to take effect. Reboot now?"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
|
|
|
@ -118,7 +118,7 @@ BEGIN
|
|||
IDS_CTRL_SHIFT "Ctrl+Shift"
|
||||
IDS_LEFT_ALT_SHIFT "Alt зліва+Shift"
|
||||
IDS_SWITCH_BET_INLANG "Перемикання мов вводу"
|
||||
IDS_REBOOT_NOW, "Перезавантажити зараз?"
|
||||
IDS_REBOOT_NOW "You have to restart the system for the settings to take effect. Reboot now?"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
|
|
|
@ -112,7 +112,7 @@ BEGIN
|
|||
IDS_CTRL_SHIFT "Ctrl+Shift"
|
||||
IDS_LEFT_ALT_SHIFT "左 Alt+Shift"
|
||||
IDS_SWITCH_BET_INLANG "在输入语言间切换"
|
||||
IDS_REBOOT_NOW, "要现在重新启动计算机吗?"
|
||||
IDS_REBOOT_NOW "You have to restart the system for the settings to take effect. Reboot now?"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
|
|
|
@ -118,7 +118,7 @@ BEGIN
|
|||
IDS_CTRL_SHIFT "Ctrl+Shift"
|
||||
IDS_LEFT_ALT_SHIFT "左 Alt+Shift"
|
||||
IDS_SWITCH_BET_INLANG "在輸入語言間切換"
|
||||
IDS_REBOOT_NOW, "要立即重新啟動嗎?"
|
||||
IDS_REBOOT_NOW "You have to restart the system for the settings to take effect. Reboot now?"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
|
|
|
@ -118,7 +118,7 @@ BEGIN
|
|||
IDS_CTRL_SHIFT "Ctrl+Shift"
|
||||
IDS_LEFT_ALT_SHIFT "左 Alt+Shift"
|
||||
IDS_SWITCH_BET_INLANG "在輸入語言間切換"
|
||||
IDS_REBOOT_NOW, "要立即重新啟動嗎?"
|
||||
IDS_REBOOT_NOW "You have to restart the system for the settings to take effect. Reboot now?"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
|
|
|
@ -15,7 +15,6 @@ static INT s_nAliveLeafCount = 0;
|
|||
static INT s_nRootCount = 0;
|
||||
static INT s_iKeyboardImage = -1;
|
||||
static INT s_iDotImage = -1;
|
||||
static BOOL s_bDefaultInputChanged = FALSE;
|
||||
|
||||
static HICON
|
||||
CreateLayoutIcon(LANGID LangID)
|
||||
|
@ -461,12 +460,12 @@ OnCommandSettingsPage(HWND hwndDlg, WPARAM wParam)
|
|||
if (HIWORD(item.lParam)) // Leaf?
|
||||
{
|
||||
if (InputList_Remove((INPUT_LIST_NODE*)item.lParam))
|
||||
s_bDefaultInputChanged = TRUE;
|
||||
g_bRebootNeeded = TRUE;
|
||||
}
|
||||
else // Root?
|
||||
{
|
||||
if (InputList_RemoveByLang(LOWORD(item.lParam)))
|
||||
s_bDefaultInputChanged = TRUE;
|
||||
g_bRebootNeeded = TRUE;
|
||||
}
|
||||
|
||||
UpdateInputListView(hwndList);
|
||||
|
@ -533,7 +532,7 @@ OnCommandSettingsPage(HWND hwndDlg, WPARAM wParam)
|
|||
INPUT_LIST_NODE* pNode = (INPUT_LIST_NODE*)lParam;
|
||||
if (!(pNode->wFlags & INPUT_LIST_NODE_FLAG_DEFAULT))
|
||||
{
|
||||
s_bDefaultInputChanged = TRUE;
|
||||
g_bRebootNeeded = TRUE;
|
||||
InputList_SetDefault(pNode);
|
||||
UpdateInputListView(hwndList);
|
||||
SetControlsState(hwndDlg);
|
||||
|
@ -546,24 +545,6 @@ OnCommandSettingsPage(HWND hwndDlg, WPARAM wParam)
|
|||
}
|
||||
}
|
||||
|
||||
static BOOL IsRebootNeeded(VOID)
|
||||
{
|
||||
INPUT_LIST_NODE *pNode;
|
||||
|
||||
if (s_bDefaultInputChanged)
|
||||
return TRUE;
|
||||
|
||||
for (pNode = InputList_GetFirst(); pNode != NULL; pNode = pNode->pNext)
|
||||
{
|
||||
if (IS_IME_HKL(pNode->hkl)) /* IME? */
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL EnableProcessPrivileges(LPCWSTR lpPrivilegeName, BOOL bEnable)
|
||||
{
|
||||
HANDLE hToken;
|
||||
|
@ -619,23 +600,8 @@ OnNotifySettingsPage(HWND hwndDlg, LPARAM lParam)
|
|||
|
||||
case PSN_APPLY:
|
||||
{
|
||||
BOOL bRebootNeeded = IsRebootNeeded();
|
||||
|
||||
/* Write Input Methods list to registry */
|
||||
if (InputList_Process() && bRebootNeeded)
|
||||
{
|
||||
/* Needs reboot */
|
||||
WCHAR szNeedsReboot[128], szLanguage[64];
|
||||
LoadStringW(hApplet, IDS_REBOOT_NOW, szNeedsReboot, _countof(szNeedsReboot));
|
||||
LoadStringW(hApplet, IDS_LANGUAGE, szLanguage, _countof(szLanguage));
|
||||
|
||||
if (MessageBoxW(hwndDlg, szNeedsReboot, szLanguage,
|
||||
MB_ICONINFORMATION | MB_YESNOCANCEL) == IDYES)
|
||||
{
|
||||
EnableProcessPrivileges(SE_SHUTDOWN_NAME, TRUE);
|
||||
ExitWindowsEx(EWX_REBOOT | EWX_FORCE, 0);
|
||||
}
|
||||
}
|
||||
g_bRebootNeeded |= InputList_Process();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue