From e9919544cd01408a96863d3d40912bbc09b3e824 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Harabie=C5=84?= Date: Sat, 24 Aug 2024 18:49:49 +0200 Subject: [PATCH] Fix handling of combo-box selection changes in Options --- launcher/OptionsDisplayDlg.cpp | 25 ++++++++++++------------- launcher/OptionsDisplayDlg.h | 2 +- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/launcher/OptionsDisplayDlg.cpp b/launcher/OptionsDisplayDlg.cpp index 025b37a5..fbc9ffe8 100644 --- a/launcher/OptionsDisplayDlg.cpp +++ b/launcher/OptionsDisplayDlg.cpp @@ -119,21 +119,20 @@ void OptionsDisplayDlg::UpdateColorDepthCombo() m_color_depth_combo.SetCurSel(m_conf.res_bpp == 16 ? index_16 : index_32); } -LRESULT OptionsDisplayDlg::OnNotify([[ maybe_unused ]] WPARAM wparam, LPARAM lparam) +BOOL OptionsDisplayDlg::OnCommand(WPARAM wparam, [[ maybe_unused ]] LPARAM lparam) { - auto& nmhdr = *reinterpret_cast(lparam); - switch (nmhdr.code) { - case CBN_SELCHANGE: - if (nmhdr.idFrom == IDC_ADAPTER_COMBO) { - OnAdapterChange(); + if (HIWORD(wparam) == CBN_SELCHANGE) { + switch (LOWORD(wparam)) { + case IDC_ADAPTER_COMBO: + OnAdapterChange(); + break; + case IDC_WND_MODE_COMBO: + OnWindowModeChange(); + break; + case IDC_COLOR_DEPTH_COMBO: + OnColorDepthChange(); + break; } - else if (nmhdr.idFrom == IDC_WND_MODE_COMBO) { - OnWindowModeChange(); - } - else if (nmhdr.idFrom == IDC_COLOR_DEPTH_COMBO) { - OnColorDepthChange(); - } - break; } return 0; } diff --git a/launcher/OptionsDisplayDlg.h b/launcher/OptionsDisplayDlg.h index bad10e4f..d5df93bb 100644 --- a/launcher/OptionsDisplayDlg.h +++ b/launcher/OptionsDisplayDlg.h @@ -20,7 +20,7 @@ class OptionsDisplayDlg : public CDialog protected: BOOL OnInitDialog() override; - LRESULT OnNotify(WPARAM wparam, LPARAM lparam) override; + BOOL OnCommand(WPARAM wparam, LPARAM lparam) override; private: void InitToolTip();