From 4269b5598af6398acea4af7dd650e7db29646ab7 Mon Sep 17 00:00:00 2001 From: Quantum Date: Sun, 9 Nov 2025 02:13:29 -0500 Subject: [PATCH] [idd] helper: implement keyboard navigation in config window --- idd/LGIddHelper/CConfigWindow.cpp | 14 +++++++------- idd/LGIddHelper/CNotifyWindow.cpp | 5 +++++ idd/LGIddHelper/CNotifyWindow.h | 1 + idd/LGIddHelper/main.cpp | 8 ++++++-- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/idd/LGIddHelper/CConfigWindow.cpp b/idd/LGIddHelper/CConfigWindow.cpp index 8b07e920..540b1260 100644 --- a/idd/LGIddHelper/CConfigWindow.cpp +++ b/idd/LGIddHelper/CConfigWindow.cpp @@ -103,7 +103,7 @@ LRESULT CConfigWindow::onCreate() m_modeGroup.reset(new CGroupBox(L"Custom modes", WS_CHILD | WS_VISIBLE, m_hwnd)); - m_modeBox.reset(new CListBox(WS_CHILD | WS_VISIBLE | WS_VSCROLL | LBS_NOTIFY, m_hwnd)); + m_modeBox.reset(new CListBox(WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | LBS_NOTIFY, m_hwnd)); if (m_modes) updateModeList(); @@ -111,18 +111,18 @@ LRESULT CConfigWindow::onCreate() 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_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 | ES_NUMBER, m_hwnd)); - m_modeRefresh.reset(new CEditWidget(WS_CHILD | WS_VISIBLE | ES_LEFT | ES_NUMBER, m_hwnd)); + m_modeWidth.reset(new CEditWidget(WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_LEFT | ES_NUMBER, m_hwnd)); + m_modeHeight.reset(new CEditWidget(WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_LEFT | ES_NUMBER, m_hwnd)); + m_modeRefresh.reset(new CEditWidget(WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_LEFT | ES_NUMBER, 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_modeUpdate.reset(new CButton(L"Save", WS_CHILD | WS_VISIBLE | WS_TABSTOP, m_hwnd)); + m_modeDelete.reset(new CButton(L"Delete", WS_CHILD | WS_VISIBLE | WS_TABSTOP, m_hwnd)); EnableWindow(*m_modeUpdate, FALSE); EnableWindow(*m_modeDelete, FALSE); m_autosizeGroup.reset(new CGroupBox(L"Autosizing", WS_CHILD | WS_VISIBLE, m_hwnd)); m_defRefreshLabel.reset(new CStaticWidget(L"Default refresh:", WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, m_hwnd)); - m_defRefresh.reset(new CEditWidget(WS_CHILD | WS_VISIBLE | ES_LEFT | ES_NUMBER, m_hwnd)); + m_defRefresh.reset(new CEditWidget(WS_CHILD | WS_VISIBLE | ES_LEFT | ES_NUMBER | WS_TABSTOP, m_hwnd)); m_defRefreshHz.reset(new CStaticWidget(L"Hz", WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, m_hwnd)); RECT client = { 0, 0, (LONG)(436 * m_scale), (LONG)(300 * m_scale) }; diff --git a/idd/LGIddHelper/CNotifyWindow.cpp b/idd/LGIddHelper/CNotifyWindow.cpp index 83b756fb..ff932000 100644 --- a/idd/LGIddHelper/CNotifyWindow.cpp +++ b/idd/LGIddHelper/CNotifyWindow.cpp @@ -143,6 +143,11 @@ void CNotifyWindow::registerIcon() DEBUG_ERROR_HR(GetLastError(), "Shell_NotifyIcon(NIM_SETVERSION)"); } +HWND CNotifyWindow::hwndDialog() +{ + return m_config ? m_config->hwnd() : nullptr; +} + void CNotifyWindow::close() { closeRequested = true; diff --git a/idd/LGIddHelper/CNotifyWindow.h b/idd/LGIddHelper/CNotifyWindow.h index 4527c78b..8d5a82b8 100644 --- a/idd/LGIddHelper/CNotifyWindow.h +++ b/idd/LGIddHelper/CNotifyWindow.h @@ -28,5 +28,6 @@ public: ~CNotifyWindow() override; static bool registerClass(); + HWND hwndDialog(); void close(); }; diff --git a/idd/LGIddHelper/main.cpp b/idd/LGIddHelper/main.cpp index 3f7bb135..df13b898 100644 --- a/idd/LGIddHelper/main.cpp +++ b/idd/LGIddHelper/main.cpp @@ -105,8 +105,12 @@ int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _ MSG msg; while (GetMessage(&msg, NULL, 0, 0) > 0) { - TranslateMessage(&msg); - DispatchMessage(&msg); + HWND hDlg = window.hwndDialog(); + if (!hDlg || !IsDialogMessage(hDlg, &msg)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } } (void) UnregisterWait(hWait);