Sebastian Lackner : winecfg: Add library override instead of closing winecfg when pressing Enter.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Mar 4 09:22:16 CST 2015


Module: wine
Branch: master
Commit: 317fc7aaf8dfa5153d4efbb27d0944514b73de0f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=317fc7aaf8dfa5153d4efbb27d0944514b73de0f

Author: Sebastian Lackner <sebastian at fds-team.de>
Date:   Sat Feb  7 08:00:34 2015 +0100

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:




More information about the wine-cvs mailing list