From 6fb62f52f5a6df15fa3b16d4f3c3551f4d5eebfb Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@sloboda.ru>
Date: Sat, 29 Jan 2000 22:09:40 +0000
Subject: [PATCH] Correct the behaviour of the accelerator keys in dialogs
 according to the Windows' one.

---
 controls/button.c | 5 +++++
 windows/dialog.c  | 6 ++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/controls/button.c b/controls/button.c
index 7d9097b778a..fb958e56796 100644
--- a/controls/button.c
+++ b/controls/button.c
@@ -265,6 +265,11 @@ static inline LRESULT WINAPI ButtonWndProc_locked(WND* wndPtr, UINT uMsg,
         PAINT_BUTTON( wndPtr, style, ODA_DRAWENTIRE );
         break;
 
+    case BM_CLICK:
+	SendMessageA( hWnd, WM_LBUTTONDOWN, 0, 0 );
+	SendMessageA( hWnd, WM_LBUTTONUP, 0, 0 );
+	break;
+
     case BM_SETIMAGE:
 	oldHbitmap = infoPtr->hImage;
 	if ((wndPtr->dwStyle & BS_BITMAP) || (wndPtr->dwStyle & BS_ICON))
diff --git a/windows/dialog.c b/windows/dialog.c
index 3e1a02ef831..3d9b73d83b6 100644
--- a/windows/dialog.c
+++ b/windows/dialog.c
@@ -1174,10 +1174,8 @@ static BOOL DIALOG_IsAccelerator( HWND hwnd, HWND hwndDlg, WPARAM vKey )
                         }
                         else if (dlgCode & DLGC_BUTTON)
                         {
-                            /* send command message as from the control */
-                            SendMessageA( hwndDlg, WM_COMMAND, 
-                                MAKEWPARAM( LOWORD(wndPtr->wIDmenu), BN_CLICKED ),
-                                (LPARAM)hwndControl );
+                            /* send BM_CLICK message to the control */
+                            SendMessageA( hwndControl, BM_CLICK, 0, 0 );
                         }
 
                         RetVal = TRUE;
-- 
GitLab