Define Ctrl-R as right-click in WB Comment dialog
authorH.G. Muller <h.g.muller@hccnet.nl>
Sun, 2 Jan 2011 13:11:45 +0000 (14:11 +0100)
committerArun Persaud <arun@nubati.net>
Tue, 11 Jan 2011 05:22:03 +0000 (21:22 -0800)
To allow JAWS users to load a variation through the keyboard, Ctrl-R is
equated to a right click at the position of the caret or selection.

winboard/winboard.c

index bf84aaa..2f15610 100644 (file)
@@ -6255,7 +6255,7 @@ CommentDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
        sizeY = newSizeY;\r
       }\r
     }\r
-    SendDlgItemMessage( hDlg, OPT_CommentText, EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS );\r
+    SendDlgItemMessage( hDlg, OPT_CommentText, EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_KEYEVENTS );\r
     return FALSE;\r
 \r
   case WM_COMMAND: /* message: received a command */\r
@@ -6304,13 +6304,19 @@ CommentDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
         if( wParam == OPT_CommentText ) {\r
             MSGFILTER * lpMF = (MSGFILTER *) lParam;\r
 \r
-            if( lpMF->msg == WM_RBUTTONDOWN && (lpMF->wParam & (MK_CONTROL | MK_SHIFT)) == 0 ) {\r
+            if( lpMF->msg == WM_RBUTTONDOWN && (lpMF->wParam & (MK_CONTROL | MK_SHIFT)) == 0 ||\r
+                lpMF->msg == WM_CHAR && lpMF->wParam == '\022' ) {\r
                 POINTL pt;\r
                 LRESULT index;\r
 \r
                 pt.x = LOWORD( lpMF->lParam );\r
                 pt.y = HIWORD( lpMF->lParam );\r
 \r
+                if(lpMF->msg == WM_CHAR) {\r
+                        CHARRANGE sel;\r
+                        SendDlgItemMessage( hDlg, OPT_CommentText, EM_EXGETSEL, 0, (LPARAM) &sel );\r
+                        index = sel.cpMin;\r
+                } else\r
                 index = SendDlgItemMessage( hDlg, OPT_CommentText, EM_CHARFROMPOS, 0, (LPARAM) &pt );\r
 \r
                hwndText = GetDlgItem(hDlg, OPT_CommentText); // cloned from above\r