Add a parameter to write_clip() so that windlg.c need not call term_deselect
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Fri, 6 Oct 2000 12:32:25 +0000 (12:32 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Fri, 6 Oct 2000 12:32:25 +0000 (12:32 +0000)
git-svn-id: svn://svn.tartarus.org/sgt/putty@681 cda61777-01e9-0310-a592-d414129be87e

plink.c
putty.h
scp.c
terminal.c
windlg.c
window.c

diff --git a/plink.c b/plink.c
index 6ac5e0a..62394c0 100644 (file)
--- a/plink.c
+++ b/plink.c
@@ -38,7 +38,7 @@ static char *password = NULL;
 /*
  * Stubs for linking with other modules.
  */
-void write_clip (void *data, int len) { }
+void write_clip (void *data, int len, int must_deselect) { }
 void term_deselect(void) { }
 
 HANDLE outhandle;
@@ -112,7 +112,7 @@ static int get_password(const char *prompt, char *str, int maxlen)
     return 1;
 }
 
-int WINAPI stdin_read_thread(void *param) {
+static int WINAPI stdin_read_thread(void *param) {
     struct input_data *idata = (struct input_data *)param;
     HANDLE inhandle;
 
diff --git a/putty.h b/putty.h
index 40dd8cb..2f510ff 100644 (file)
--- a/putty.h
+++ b/putty.h
@@ -244,7 +244,7 @@ Context get_ctx(void);
 void free_ctx (Context);
 void palette_set (int, int, int, int);
 void palette_reset (void);
-void write_clip (void *, int);
+void write_clip (void *, int, int);
 void get_clip (void **, int *);
 void optimised_move (int, int, int);
 void connection_fatal(char *, ...);
diff --git a/scp.c b/scp.c
index ad1e69a..53db80a 100644 (file)
--- a/scp.c
+++ b/scp.c
@@ -77,7 +77,7 @@ static void gui_update_stats(char *name, unsigned long size, int percentage, tim
  * (should) never get called.
  */
 void begin_session(void) { }
-void write_clip (void *data, int len) { }
+void write_clip (void *data, int len, int must_deselect) { }
 void term_deselect(void) { }
 
 /* GUI Adaptation - Sept 2000 */
index f5a2ae0..2191192 100644 (file)
@@ -2001,7 +2001,7 @@ void term_mouse (Mouse_Button b, Mouse_Action a, int x, int y) {
                }
                q = lineend + 1;       /* start of next line */
            }
-           write_clip (selspace, p - selspace);
+           write_clip (selspace, p - selspace, FALSE);
            selstate = SELECTED;
        } else
            selstate = NO_SELECTION;
index 14a60e8..f660fb0 100644 (file)
--- a/windlg.c
+++ b/windlg.c
@@ -354,6 +354,11 @@ static int CALLBACK LogProc (HWND hwnd, UINT msg,
                     char *clipdata;
                     static unsigned char sel_nl[] = SEL_NL;
 
+                    if (count == 0) {  /* can't copy zero stuff */
+                        MessageBeep(0);
+                        break;
+                    }
+
                     size = 0;
                     for (i = 0; i < count; i++)
                         size += strlen(events[selitems[i]]) + sizeof(sel_nl);
@@ -369,11 +374,14 @@ static int CALLBACK LogProc (HWND hwnd, UINT msg,
                             memcpy(p, sel_nl, sizeof(sel_nl));
                             p += sizeof(sel_nl);
                         }
-                        write_clip(clipdata, size);
-                        term_deselect();
+                        write_clip(clipdata, size, TRUE);
                         free(clipdata);
                     }
                     free(selitems);
+
+                    for (i = 0; i < nevents; i++)
+                        SendDlgItemMessage(hwnd, IDN_LIST, LB_SETSEL,
+                                           FALSE, i);
                 }
             }
             return 0;
index fe9d2e9..0ab58cf 100644 (file)
--- a/window.c
+++ b/window.c
@@ -2242,7 +2242,7 @@ void palette_reset (void) {
     }
 }
 
-void write_clip (void *data, int len) {
+void write_clip (void *data, int len, int must_deselect) {
     HGLOBAL clipdata;
     void *lock;
 
@@ -2256,14 +2256,18 @@ void write_clip (void *data, int len) {
     ((unsigned char *) lock) [len] = 0;
     GlobalUnlock (clipdata);
 
-    SendMessage (hwnd, WM_IGNORE_CLIP, TRUE, 0);
+    if (!must_deselect)
+        SendMessage (hwnd, WM_IGNORE_CLIP, TRUE, 0);
+
     if (OpenClipboard (hwnd)) {
        EmptyClipboard();
        SetClipboardData (CF_TEXT, clipdata);
        CloseClipboard();
     } else
        GlobalFree (clipdata);
-    SendMessage (hwnd, WM_IGNORE_CLIP, FALSE, 0);
+
+    if (!must_deselect)
+        SendMessage (hwnd, WM_IGNORE_CLIP, FALSE, 0);
 }
 
 void get_clip (void **p, int *len) {