Fixed crash when tray menu is open while the language combobox is open in Manage Settings.

This commit is contained in:
Birunthan Mohanathas 2012-01-28 16:47:26 +00:00
parent 81b6813e3a
commit e14ef154f3
3 changed files with 41 additions and 38 deletions

View File

@ -244,7 +244,7 @@ INT_PTR CDialogAbout::OnInitDialog(WPARAM wParam, LPARAM lParam)
HICON hIcon = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_RAINMETER), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED); HICON hIcon = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_RAINMETER), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED);
SendMessage(m_Window, WM_SETICON, ICON_SMALL, (LPARAM)hIcon); SendMessage(m_Window, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
if (wcscmp(GetString(ID_STR_ISRTL), L"1") == 0) if (*GetString(ID_STR_ISRTL) == L'1')
{ {
// Use RTL layout if using a RTL language // Use RTL layout if using a RTL language
SetDialogRTL(); SetDialogRTL();

View File

@ -226,7 +226,7 @@ INT_PTR CDialogManage::OnInitDialog(WPARAM wParam, LPARAM lParam)
HICON hIcon = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_RAINMETER), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED); HICON hIcon = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_RAINMETER), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED);
SendMessage(m_Window, WM_SETICON, ICON_SMALL, (LPARAM)hIcon); SendMessage(m_Window, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
if (wcscmp(GetString(ID_STR_ISRTL), L"1") == 0) if (*GetString(ID_STR_ISRTL) == L'1')
{ {
// Use RTL layout if using a RTL language // Use RTL layout if using a RTL language
SetDialogRTL(); SetDialogRTL();
@ -882,7 +882,7 @@ INT_PTR CDialogManage::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
TrackPopupMenu( TrackPopupMenu(
menu, menu,
TPM_RIGHTBUTTON | TPM_LEFTALIGN, TPM_RIGHTBUTTON | TPM_LEFTALIGN,
(wcscmp(GetString(ID_STR_ISRTL), L"1") == 0) ? r.right : r.left, (*GetString(ID_STR_ISRTL) == L'1') ? r.right : r.left,
--r.bottom, --r.bottom,
0, 0,
m_Window, m_Window,
@ -1048,7 +1048,7 @@ INT_PTR CDialogManage::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
TrackPopupMenu( TrackPopupMenu(
subMenu, subMenu,
TPM_RIGHTBUTTON | TPM_LEFTALIGN, TPM_RIGHTBUTTON | TPM_LEFTALIGN,
(wcscmp(GetString(ID_STR_ISRTL), L"1") == 0) ? r.right : r.left, (*GetString(ID_STR_ISRTL) == L'1') ? r.right : r.left,
--r.bottom, --r.bottom,
0, 0,
m_Window, m_Window,
@ -1709,9 +1709,11 @@ INT_PTR CDialogManage::CTabSettings::OnCommand(WPARAM wParam, LPARAM lParam)
case IDC_MANAGESETTINGS_LANGUAGE_COMBOBOX: case IDC_MANAGESETTINGS_LANGUAGE_COMBOBOX:
if (HIWORD(wParam) == CBN_SELCHANGE) if (HIWORD(wParam) == CBN_SELCHANGE)
{ {
WCHAR buffer[16];
int sel = ComboBox_GetCurSel((HWND)lParam); int sel = ComboBox_GetCurSel((HWND)lParam);
LCID lcid = (LCID)ComboBox_GetItemData((HWND)lParam, sel); LCID lcid = (LCID)ComboBox_GetItemData((HWND)lParam, sel);
if (lcid != Rainmeter->m_ResourceLCID)
{
WCHAR buffer[16];
_ultow(lcid, buffer, 10); _ultow(lcid, buffer, 10);
WritePrivateProfileString(L"Rainmeter", L"Language", buffer, Rainmeter->GetIniFile().c_str()); WritePrivateProfileString(L"Rainmeter", L"Language", buffer, Rainmeter->GetIniFile().c_str());
@ -1747,6 +1749,7 @@ INT_PTR CDialogManage::CTabSettings::OnCommand(WPARAM wParam, LPARAM lParam)
SendMessage(c_Dialog->GetWindow(), WM_DELAYED_CLOSE, 0, 0); SendMessage(c_Dialog->GetWindow(), WM_DELAYED_CLOSE, 0, 0);
ExecuteBang(L"!Manage Settings"); // Delayed execute ExecuteBang(L"!Manage Settings"); // Delayed execute
} }
}
break; break;
case IDC_MANAGESETTINGS_CHECKUPDATES_CHECKBOX: case IDC_MANAGESETTINGS_CHECKUPDATES_CHECKBOX:

View File

@ -31,7 +31,7 @@
// //
// Exported functions // Exported functions
// //
EXTERN_C
#ifdef __cplusplus #ifdef __cplusplus
LIBRARY_EXPORT LPCWSTR __stdcall RmReadString(void* rm, LPCWSTR option, LPCWSTR defValue, BOOL replaceMeasures = TRUE); LIBRARY_EXPORT LPCWSTR __stdcall RmReadString(void* rm, LPCWSTR option, LPCWSTR defValue, BOOL replaceMeasures = TRUE);
#else #else