diff --git a/dll/cpl/input/advanced_settings_page.c b/dll/cpl/input/advanced_settings_page.c index 77536525a34..45e32591095 100644 --- a/dll/cpl/input/advanced_settings_page.c +++ b/dll/cpl/input/advanced_settings_page.c @@ -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; } diff --git a/dll/cpl/input/input.c b/dll/cpl/input/input.c index cd8a0291cb5..de64edf9af7 100644 --- a/dll/cpl/input/input.c +++ b/dll/cpl/input/input.c @@ -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; } diff --git a/dll/cpl/input/input.h b/dll/cpl/input/input.h index 4f06ea66ac6..b57993c0c2c 100644 --- a/dll/cpl/input/input.h +++ b/dll/cpl/input/input.h @@ -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 diff --git a/dll/cpl/input/input_list.c b/dll/cpl/input/input_list.c index 49347d841dc..8cb6b443cca 100644 --- a/dll/cpl/input/input_list.c +++ b/dll/cpl/input/input_list.c @@ -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)) { diff --git a/dll/cpl/input/lang/bg-BG.rc b/dll/cpl/input/lang/bg-BG.rc index d7e7ff05828..fc6385936bc 100644 --- a/dll/cpl/input/lang/bg-BG.rc +++ b/dll/cpl/input/lang/bg-BG.rc @@ -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 diff --git a/dll/cpl/input/lang/cs-CZ.rc b/dll/cpl/input/lang/cs-CZ.rc index 1b58469d1d1..ebea8f9fd25 100644 --- a/dll/cpl/input/lang/cs-CZ.rc +++ b/dll/cpl/input/lang/cs-CZ.rc @@ -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 diff --git a/dll/cpl/input/lang/de-DE.rc b/dll/cpl/input/lang/de-DE.rc index 38984e61436..4e55706aa26 100644 --- a/dll/cpl/input/lang/de-DE.rc +++ b/dll/cpl/input/lang/de-DE.rc @@ -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 diff --git a/dll/cpl/input/lang/el-GR.rc b/dll/cpl/input/lang/el-GR.rc index fa982cd7b80..b5ca7be6454 100644 --- a/dll/cpl/input/lang/el-GR.rc +++ b/dll/cpl/input/lang/el-GR.rc @@ -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 diff --git a/dll/cpl/input/lang/en-US.rc b/dll/cpl/input/lang/en-US.rc index 9e8709b065f..8ba0158e9e8 100644 --- a/dll/cpl/input/lang/en-US.rc +++ b/dll/cpl/input/lang/en-US.rc @@ -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 diff --git a/dll/cpl/input/lang/es-ES.rc b/dll/cpl/input/lang/es-ES.rc index 9401b59f1d6..19acb40fccd 100644 --- a/dll/cpl/input/lang/es-ES.rc +++ b/dll/cpl/input/lang/es-ES.rc @@ -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 diff --git a/dll/cpl/input/lang/fr-FR.rc b/dll/cpl/input/lang/fr-FR.rc index 24ab68dab44..1e45d284a9a 100644 --- a/dll/cpl/input/lang/fr-FR.rc +++ b/dll/cpl/input/lang/fr-FR.rc @@ -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 */ diff --git a/dll/cpl/input/lang/he-IL.rc b/dll/cpl/input/lang/he-IL.rc index e6685eb3155..2a838ad2a4d 100644 --- a/dll/cpl/input/lang/he-IL.rc +++ b/dll/cpl/input/lang/he-IL.rc @@ -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 diff --git a/dll/cpl/input/lang/id-ID.rc b/dll/cpl/input/lang/id-ID.rc index 40667cfbc71..323dfa45224 100644 --- a/dll/cpl/input/lang/id-ID.rc +++ b/dll/cpl/input/lang/id-ID.rc @@ -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 diff --git a/dll/cpl/input/lang/it-IT.rc b/dll/cpl/input/lang/it-IT.rc index 44acb4187b2..19b98363462 100644 --- a/dll/cpl/input/lang/it-IT.rc +++ b/dll/cpl/input/lang/it-IT.rc @@ -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 diff --git a/dll/cpl/input/lang/ja-JP.rc b/dll/cpl/input/lang/ja-JP.rc index a3fbc0b8925..ddbac542302 100644 --- a/dll/cpl/input/lang/ja-JP.rc +++ b/dll/cpl/input/lang/ja-JP.rc @@ -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 diff --git a/dll/cpl/input/lang/no-NO.rc b/dll/cpl/input/lang/no-NO.rc index 2dd97cb0dcd..75a786126bc 100644 --- a/dll/cpl/input/lang/no-NO.rc +++ b/dll/cpl/input/lang/no-NO.rc @@ -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 diff --git a/dll/cpl/input/lang/pl-PL.rc b/dll/cpl/input/lang/pl-PL.rc index 8643faabee5..80f6be90a27 100644 --- a/dll/cpl/input/lang/pl-PL.rc +++ b/dll/cpl/input/lang/pl-PL.rc @@ -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 diff --git a/dll/cpl/input/lang/pt-BR.rc b/dll/cpl/input/lang/pt-BR.rc index 9dbee2c881a..a320f414a53 100644 --- a/dll/cpl/input/lang/pt-BR.rc +++ b/dll/cpl/input/lang/pt-BR.rc @@ -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 diff --git a/dll/cpl/input/lang/pt-PT.rc b/dll/cpl/input/lang/pt-PT.rc index b8d05992c31..7972707e353 100644 --- a/dll/cpl/input/lang/pt-PT.rc +++ b/dll/cpl/input/lang/pt-PT.rc @@ -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 diff --git a/dll/cpl/input/lang/ro-RO.rc b/dll/cpl/input/lang/ro-RO.rc index e20715df5e9..00835477038 100644 --- a/dll/cpl/input/lang/ro-RO.rc +++ b/dll/cpl/input/lang/ro-RO.rc @@ -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 diff --git a/dll/cpl/input/lang/ru-RU.rc b/dll/cpl/input/lang/ru-RU.rc index ca1ddcccedd..838262e836c 100644 --- a/dll/cpl/input/lang/ru-RU.rc +++ b/dll/cpl/input/lang/ru-RU.rc @@ -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 diff --git a/dll/cpl/input/lang/sk-SK.rc b/dll/cpl/input/lang/sk-SK.rc index 89422607055..4cdaad5f0cc 100644 --- a/dll/cpl/input/lang/sk-SK.rc +++ b/dll/cpl/input/lang/sk-SK.rc @@ -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 diff --git a/dll/cpl/input/lang/sq-AL.rc b/dll/cpl/input/lang/sq-AL.rc index d8760da6718..b1026259e29 100644 --- a/dll/cpl/input/lang/sq-AL.rc +++ b/dll/cpl/input/lang/sq-AL.rc @@ -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 diff --git a/dll/cpl/input/lang/tr-TR.rc b/dll/cpl/input/lang/tr-TR.rc index 02e3367a43b..9bc688f7e89 100644 --- a/dll/cpl/input/lang/tr-TR.rc +++ b/dll/cpl/input/lang/tr-TR.rc @@ -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 diff --git a/dll/cpl/input/lang/uk-UA.rc b/dll/cpl/input/lang/uk-UA.rc index 7e3be1e26c7..deb2fce89ce 100644 --- a/dll/cpl/input/lang/uk-UA.rc +++ b/dll/cpl/input/lang/uk-UA.rc @@ -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 diff --git a/dll/cpl/input/lang/zh-CN.rc b/dll/cpl/input/lang/zh-CN.rc index 41053c006e6..d35e4903531 100644 --- a/dll/cpl/input/lang/zh-CN.rc +++ b/dll/cpl/input/lang/zh-CN.rc @@ -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 diff --git a/dll/cpl/input/lang/zh-HK.rc b/dll/cpl/input/lang/zh-HK.rc index 355dd92d44e..cdbcbf1c6bc 100644 --- a/dll/cpl/input/lang/zh-HK.rc +++ b/dll/cpl/input/lang/zh-HK.rc @@ -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 diff --git a/dll/cpl/input/lang/zh-TW.rc b/dll/cpl/input/lang/zh-TW.rc index e535fd54902..edfae5f8edc 100644 --- a/dll/cpl/input/lang/zh-TW.rc +++ b/dll/cpl/input/lang/zh-TW.rc @@ -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 diff --git a/dll/cpl/input/settings_page.c b/dll/cpl/input/settings_page.c index bf10b057623..7f5057cddad 100644 --- a/dll/cpl/input/settings_page.c +++ b/dll/cpl/input/settings_page.c @@ -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; } }