Compare commits

..

4 Commits

Author SHA1 Message Date
Quantum
4882a3fbd6 [idd] helper: remove compiler warnings 2025-11-09 21:51:28 -05:00
Quantum
3ed08ba56c [idd] helper: require numeric input for modes 2025-11-10 12:01:13 +11:00
Quantum
70da98c1a1 [idd] helper: implement UI for default refresh rate
The UI is not yet hooked up to anything.
2025-11-10 11:58:52 +11:00
Quantum
ed1602fc74 [idd] helper: fix notification icon creation on explorer start 2025-11-10 11:44:47 +11:00
4 changed files with 15 additions and 7 deletions

View File

@@ -111,9 +111,9 @@ LRESULT CConfigWindow::onCreate()
m_heightLabel.reset(new CStaticWidget(L"Height:", WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, m_hwnd)); m_heightLabel.reset(new CStaticWidget(L"Height:", WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, m_hwnd));
m_refreshLabel.reset(new CStaticWidget(L"Refresh:", WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, m_hwnd)); m_refreshLabel.reset(new CStaticWidget(L"Refresh:", WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, m_hwnd));
m_modeWidth.reset(new CEditWidget(WS_CHILD | WS_VISIBLE | ES_LEFT, m_hwnd)); m_modeWidth.reset(new CEditWidget(WS_CHILD | WS_VISIBLE | ES_LEFT | ES_NUMBER, m_hwnd));
m_modeHeight.reset(new CEditWidget(WS_CHILD | WS_VISIBLE | ES_LEFT, m_hwnd)); m_modeHeight.reset(new CEditWidget(WS_CHILD | WS_VISIBLE | ES_LEFT | ES_NUMBER, m_hwnd));
m_modeRefresh.reset(new CEditWidget(WS_CHILD | WS_VISIBLE | ES_LEFT, m_hwnd)); m_modeRefresh.reset(new CEditWidget(WS_CHILD | WS_VISIBLE | ES_LEFT | ES_NUMBER, m_hwnd));
m_modeUpdate.reset(new CButton(L"Save", WS_CHILD | WS_VISIBLE, m_hwnd)); m_modeUpdate.reset(new CButton(L"Save", WS_CHILD | WS_VISIBLE, m_hwnd));
m_modeDelete.reset(new CButton(L"Delete", WS_CHILD | WS_VISIBLE, m_hwnd)); m_modeDelete.reset(new CButton(L"Delete", WS_CHILD | WS_VISIBLE, m_hwnd));
@@ -220,7 +220,7 @@ LRESULT CConfigWindow::onCommand(WORD id, WORD code, HWND hwnd)
LRESULT result = m_settings.setModes(*m_modes); LRESULT result = m_settings.setModes(*m_modes);
if (result != ERROR_SUCCESS) if (result != ERROR_SUCCESS)
DEBUG_ERROR_HR(result, "Failed to save modes"); DEBUG_ERROR_HR((HRESULT) result, "Failed to save modes");
} }
else if (hwnd == *m_modeDelete && code == BN_CLICKED && m_modes) else if (hwnd == *m_modeDelete && code == BN_CLICKED && m_modes)
{ {
@@ -234,7 +234,7 @@ LRESULT CConfigWindow::onCommand(WORD id, WORD code, HWND hwnd)
LRESULT result = m_settings.setModes(*m_modes); LRESULT result = m_settings.setModes(*m_modes);
if (result != ERROR_SUCCESS) if (result != ERROR_SUCCESS)
DEBUG_ERROR_HR(result, "Failed to save modes"); DEBUG_ERROR_HR((HRESULT) result, "Failed to save modes");
updateModeList(); updateModeList();
onModeListSelectChange(); onModeListSelectChange();

View File

@@ -15,7 +15,7 @@ std::wstring CEditWidget::getValue()
{ {
std::wstring result; std::wstring result;
result.resize(Edit_GetTextLength(m_hwnd)); result.resize(Edit_GetTextLength(m_hwnd));
Edit_GetText(m_hwnd, result.data(), result.size() + 1); Edit_GetText(m_hwnd, result.data(), (int) (result.size() + 1));
return result; return result;
} }

View File

@@ -42,7 +42,7 @@ int CListBox::getSel()
int CListBox::getData(int index) int CListBox::getData(int index)
{ {
return ListBox_GetItemData(m_hwnd, index); return (int) ListBox_GetItemData(m_hwnd, index);
} }
void CListBox::setSel(int index) void CListBox::setSel(int index)

View File

@@ -51,6 +51,7 @@ LRESULT CNotifyWindow::handleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
case WM_NOTIFY_ICON: case WM_NOTIFY_ICON:
return onNotifyIcon(LOWORD(lParam), HIWORD(lParam), GET_X_LPARAM(wParam), GET_Y_LPARAM(wParam)); return onNotifyIcon(LOWORD(lParam), HIWORD(lParam), GET_X_LPARAM(wParam), GET_Y_LPARAM(wParam));
case WM_CLEAN_UP_CONFIG: case WM_CLEAN_UP_CONFIG:
if (m_config && !m_config->hwnd()) if (m_config && !m_config->hwnd())
{ {
@@ -58,6 +59,7 @@ LRESULT CNotifyWindow::handleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
m_config.reset(); m_config.reset();
} }
return 0; return 0;
default: default:
if (s_taskbarCreated && uMsg == s_taskbarCreated) if (s_taskbarCreated && uMsg == s_taskbarCreated)
{ {
@@ -70,6 +72,9 @@ LRESULT CNotifyWindow::handleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT CNotifyWindow::onCreate() LRESULT CNotifyWindow::onCreate()
{ {
// Allow explorer to send us this message to register the notification icon.
ChangeWindowMessageFilterEx(m_hwnd, s_taskbarCreated, MSGFLT_ALLOW, NULL);
registerIcon(); registerIcon();
return 0; return 0;
} }
@@ -129,7 +134,10 @@ void CNotifyWindow::registerIcon()
StringCbCopy(m_iconData.szTip, sizeof m_iconData.szTip, L"Looking Glass (IDD)"); StringCbCopy(m_iconData.szTip, sizeof m_iconData.szTip, L"Looking Glass (IDD)");
if (!Shell_NotifyIcon(NIM_ADD, &m_iconData)) if (!Shell_NotifyIcon(NIM_ADD, &m_iconData))
{
DEBUG_ERROR_HR(GetLastError(), "Shell_NotifyIcon(NIM_ADD)"); DEBUG_ERROR_HR(GetLastError(), "Shell_NotifyIcon(NIM_ADD)");
return;
}
if (!Shell_NotifyIcon(NIM_SETVERSION, &m_iconData)) if (!Shell_NotifyIcon(NIM_SETVERSION, &m_iconData))
DEBUG_ERROR_HR(GetLastError(), "Shell_NotifyIcon(NIM_SETVERSION)"); DEBUG_ERROR_HR(GetLastError(), "Shell_NotifyIcon(NIM_SETVERSION)");