From: Hugh McMaster Subject: [Patch 1/2] winecfg: Set default button in Libraries tab [fixes bug 12804] Message-Id: <9CB7F20010CADE479EB89B7DCEDFB64269FACD5BBF@VMBX112.ihostexchange.net> Date: Tue, 24 Jun 2014 04:35:26 -0400 This patch sets the default button to IDC_DLLS_ADDDLL in the Libraries tab of winecfg when a user is typing in the combo box. This allows the user to hit the Enter key and add the override. Currently, hitting the Enter key closes winecfg, which is causing problems with many users. The patch fixes bug 12804 and was tested by Austin English. From 34fdd660fd74c1bb31dd53d6500ae1bf28e411e7 Mon Sep 17 00:00:00 2001 From: Hugh McMaster Date: Tue, 24 Jun 2014 14:34:24 +1000 Subject: winecfg - Set default button in Libraries tab [fixes bug 12804] --- programs/winecfg/libraries.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/programs/winecfg/libraries.c b/programs/winecfg/libraries.c index 660737b..83c86f8 100644 --- a/programs/winecfg/libraries.c +++ b/programs/winecfg/libraries.c @@ -421,9 +421,17 @@ static void on_add_combo_change(HWND dialog) len=SendDlgItemMessageW(dialog, IDC_DLLCOMBO, CB_GETLBTEXTLEN, sel, 0); if (buffer[0] || len>0) + { + DWORD defbtn_id = SendMessageW(GetParent(dialog), DM_GETDEFID, 0, 0); enable(IDC_DLLS_ADDDLL) + if (HIWORD(defbtn_id) == DC_HASDEFID && LOWORD(defbtn_id) == IDOK) + SendMessageW(GetParent(dialog), DM_SETDEFID, IDC_DLLS_ADDDLL, 0); + } else + { disable(IDC_DLLS_ADDDLL); + SendMessageW(GetParent(dialog), DM_SETDEFID, IDOK, 0); + } } static void set_dllmode(HWND dialog, DWORD id) @@ -503,6 +511,8 @@ static void on_add_click(HWND dialog) SendDlgItemMessageA(dialog, IDC_DLLS_LIST, LB_SELECTSTRING, 0, (LPARAM) buffer); set_controls_from_selection(dialog); + + SendMessageW(GetParent(dialog), DM_SETDEFID, IDOK, 0); } static INT_PTR CALLBACK loadorder_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) @@ -605,11 +615,6 @@ LibrariesDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) break; case WM_COMMAND: switch(HIWORD(wParam)) { - - /* FIXME: when the user hits enter in the DLL combo box we should invoke the add - * add button, rather than the propsheet OK button. But I don't know how to do that! - */ - case CBN_EDITCHANGE: if(LOWORD(wParam) == IDC_DLLCOMBO) { -- 1.8.3.2