Roman Pompejus's fix for the TAB-not-working-in-Event-Log bug
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Tue, 23 Jan 2001 17:37:52 +0000 (17:37 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Tue, 23 Jan 2001 17:37:52 +0000 (17:37 +0000)
git-svn-id: svn://svn.tartarus.org/sgt/putty@891 cda61777-01e9-0310-a592-d414129be87e

putty.h
windlg.c
window.c

diff --git a/putty.h b/putty.h
index b618dd9..20eea8b 100644 (file)
--- a/putty.h
+++ b/putty.h
@@ -85,6 +85,12 @@ GLOBAL int session_closed;
 GLOBAL char *logfile;
 
 /*
+ * Window handles for the dialog boxes that can be running during a
+ * PuTTY session.
+ */
+GLOBAL HWND logbox;
+
+/*
  * I've just looked in the windows standard headr files for WM_USER, there
  * are hundreds of flags defined using the form WM_USER+123 so I've 
  * renumbered this NETEVENT value and the two in window.c
index 7a54654..18d1aba 100644 (file)
--- a/windlg.c
+++ b/windlg.c
@@ -13,8 +13,6 @@
 static char **events = NULL;
 static int nevents = 0, negsize = 0;
 
-static HWND logbox = NULL, abtbox = NULL;
-
 static int readytogo;
 
 void force_normal(HWND hwnd)
@@ -56,6 +54,7 @@ static int CALLBACK LogProc (HWND hwnd, UINT msg,
       case WM_COMMAND:
        switch (LOWORD(wParam)) {
          case IDOK:
+         case IDCANCEL:
            logbox = NULL;
            DestroyWindow (hwnd);
            return 0;
@@ -145,8 +144,8 @@ static int CALLBACK AboutProc (HWND hwnd, UINT msg,
       case WM_COMMAND:
        switch (LOWORD(wParam)) {
          case IDOK:
-           abtbox = NULL;
-           DestroyWindow (hwnd);
+          case IDCANCEL:
+            EndDialog(hwnd, TRUE);
            return 0;
          case IDA_LICENCE:
            EnableWindow(hwnd, 0);
@@ -158,8 +157,7 @@ static int CALLBACK AboutProc (HWND hwnd, UINT msg,
        }
        return 0;
       case WM_CLOSE:
-       abtbox = NULL;
-       DestroyWindow (hwnd);
+        EndDialog(hwnd, TRUE);
        return 0;
     }
     return 0;
@@ -1996,11 +1994,7 @@ void showeventlog (HWND hwnd) {
 }
 
 void showabout (HWND hwnd) {
-    if (!abtbox) {
-       abtbox = CreateDialog (hinst, MAKEINTRESOURCE(IDD_ABOUTBOX),
-                              hwnd, AboutProc);
-       ShowWindow (abtbox, SW_SHOWNORMAL);
-    }
+    DialogBox(hinst, MAKEINTRESOURCE(IDD_ABOUTBOX),hwnd, AboutProc);
 }
 
 void verify_ssh_host_key(char *host, int port, char *keytype,
index 2e68239..cd4d539 100644 (file)
--- a/window.c
+++ b/window.c
@@ -564,7 +564,8 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) {
            }
            if(!timer_id)
                timer_id = SetTimer(hwnd, 1, 20, NULL);
-           DispatchMessage (&msg);
+            if (!(IsWindow(logbox) && IsDialogMessage(logbox, &msg)))
+                DispatchMessage (&msg);
 
            /* Make sure we blink everything that needs it. */
            term_blink(0);