--- a/programs/winecfg/libraries.c +++ b/programs/winecfg/libraries.c @@ -45,6 +45,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(winecfg); +static void on_add_click(HWND dialog); + /* dlls that shouldn't be configured anything other than builtin; list must be sorted*/ static const char * const builtin_only[] = { @@ -396,13 +398,51 @@ static void load_library_settings(HWND dialog) set_controls_from_selection(dialog); } +LRESULT CALLBACK +comboedit_wndproc (HWND hEdit, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + LPMSG lpmsg; + WNDPROC wndProc; + HWND dialog = GetParent(GetParent(hEdit)); + switch (uMsg) + { + case WM_GETDLGCODE: + if ((lpmsg = (LPMSG)lParam) != NULL ) + if (lpmsg->message == WM_KEYDOWN + && lpmsg->wParam == VK_RETURN) + return DLGC_WANTMESSAGE; + break; + case WM_KEYDOWN: + if (wParam == VK_RETURN) + { + if (IsWindowEnabled(GetDlgItem(dialog, IDC_DLLS_ADDDLL))) + on_add_click(dialog); + return 0; + } + break; + } + wndProc = (WNDPROC)GetWindowLongPtr(hEdit, GWLP_USERDATA); + return CallWindowProc(wndProc, hEdit, uMsg, wParam, lParam); +} + /* Called when the application is initialized (cannot reinit!) */ static void init_libsheet(HWND dialog) { + HWND edit; + LONG_PTR oldWndProc; + COMBOBOXINFO cbinfo = { sizeof(COMBOBOXINFO) }; + /* clear the add dll controls */ SendDlgItemMessage(dialog, IDC_DLLCOMBO, WM_SETTEXT, 1, (LPARAM) ""); load_library_list( dialog ); disable(IDC_DLLS_ADDDLL); + + /* subclass dllcombo's edit to allow return keypress handling */ + GetComboBoxInfo(GetDlgItem(dialog, IDC_DLLCOMBO), &cbinfo); + edit = cbinfo.hwndItem; /* retrieve edit box handle */ + oldWndProc = SetWindowLongPtr(edit, GWLP_WNDPROC, + (LONG_PTR) comboedit_wndproc); + SetWindowLongPtr(edit, GWLP_USERDATA, (LONG_PTR) oldWndProc); } static void on_add_combo_change(HWND dialog) @@ -601,10 +641,6 @@ LibrariesDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) 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) { --