From fa8d8f6dba0b772b2e820360dae34f994b5e78ea Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sat, 7 Feb 2015 08:00:34 +0100 Subject: winecfg: Add library override instead of closing winecfg when pressing ENTER. Based on a patch by Hugh McMaster. --- programs/winecfg/libraries.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/programs/winecfg/libraries.c b/programs/winecfg/libraries.c index 660737b..a9889e5 100644 --- a/programs/winecfg/libraries.c +++ b/programs/winecfg/libraries.c @@ -421,9 +421,15 @@ static void on_add_combo_change(HWND dialog) len=SendDlgItemMessageW(dialog, IDC_DLLCOMBO, CB_GETLBTEXTLEN, sel, 0); if (buffer[0] || len>0) + { enable(IDC_DLLS_ADDDLL) + 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) @@ -492,7 +498,8 @@ static void on_add_click(HWND dialog) SendDlgItemMessageW(dialog, IDC_DLLCOMBO, WM_SETTEXT, 0, (LPARAM)emptyW); disable(IDC_DLLS_ADDDLL); - + SendMessageW(GetParent(dialog), DM_SETDEFID, IDOK, 0); + WINE_TRACE("Adding %s as native, builtin\n", buffer); SendMessageW(GetParent(dialog), PSM_CHANGED, 0, 0); @@ -605,18 +612,18 @@ 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) - { - on_add_combo_change(hDlg); - break; - } - + if (LOWORD(wParam) == IDC_DLLCOMBO) + on_add_combo_change(hDlg); + break; + case CBN_SETFOCUS: + if (LOWORD(wParam) == IDC_DLLCOMBO) + on_add_combo_change(hDlg); + break; + case CBN_KILLFOCUS: + if (LOWORD(wParam) == IDC_DLLCOMBO) + SendMessageW(GetParent(hDlg), DM_SETDEFID, IDOK, 0); + break; case BN_CLICKED: switch(LOWORD(wParam)) { case IDC_DLLS_ADDDLL: -- 2.2.2