[PATCH 26/45] [WinHelp]: ESC should close main window

Eric Pouech eric.pouech at orange.fr
Sun Mar 23 04:19:57 CDT 2008




A+
---

 programs/winhelp/winhelp.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)


diff --git a/programs/winhelp/winhelp.c b/programs/winhelp/winhelp.c
index e0cbfd5..78cde45 100644
--- a/programs/winhelp/winhelp.c
+++ b/programs/winhelp/winhelp.c
@@ -634,7 +634,7 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow)
                                 ES_MULTILINE | ES_READONLY | WS_CHILD | WS_HSCROLL | WS_VSCROLL | WS_VISIBLE,
                                 0, 0, 0, 0, win->hMainWnd, (HMENU)CTL_ID_TEXT, Globals.hInstance, NULL);
         SendMessage(hTextWnd, EM_SETEVENTMASK, 0,
-                    SendMessage(hTextWnd, EM_GETEVENTMASK, 0, 0) | ENM_MOUSEEVENTS);
+                    SendMessage(hTextWnd, EM_GETEVENTMASK, 0, 0) | ENM_MOUSEEVENTS | ENM_KEYEVENTS);
     }
 
     if (bPopup)
@@ -669,8 +669,6 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow)
         ShowWindow(win->hMainWnd, nCmdShow);
     }
 
-    UpdateWindow(win->hMainWnd);
-
     return TRUE;
 }
 
@@ -898,13 +896,19 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
         if (wParam == CTL_ID_TEXT)
         {
             NMHDR*      nmhdr = (NMHDR*)lParam;
+            MSGFILTER*  msgf;
             RECT        rc;
 
             switch (nmhdr->code)
             {
             case EN_MSGFILTER:
-                return WINHELP_HandleTextMouse((WINHELP_WINDOW*)GetWindowLong(hWnd, 0),
-                                               (const MSGFILTER*)lParam);
+                msgf = (MSGFILTER*)lParam;
+                if (msgf->msg == WM_KEYUP && msgf->wParam == VK_ESCAPE)
+                    DestroyWindow(hWnd);
+                else
+                    return WINHELP_HandleTextMouse((WINHELP_WINDOW*)GetWindowLong(hWnd, 0),
+                                                   (const MSGFILTER*)lParam);
+                return FALSE;
             case EN_REQUESTRESIZE:
                 rc = ((REQRESIZE*)lParam)->rc;
                 win = (WINHELP_WINDOW*) GetWindowLong(hWnd, 0);





More information about the wine-patches mailing list