]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Add a parameter to write_clip() so that windlg.c need not call term_deselect
authorSimon Tatham <anakin@pobox.com>
Fri, 6 Oct 2000 12:32:25 +0000 (12:32 +0000)
committerSimon Tatham <anakin@pobox.com>
Fri, 6 Oct 2000 12:32:25 +0000 (12:32 +0000)
[originally from svn r681]

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

diff --git a/plink.c b/plink.c
index 6ac5e0ac82bc5374efd2f07b435585ffb2bc3c8c..62394c036a9e09d1ac4294e3c024f8d222e441f1 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 40dd8cb868fdeee62ea152093a96443d68d5a2db..2f510ff4053c7f4a9507a48a258c9feb385c444b 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 ad1e69a40124bbfe9b74e464c62ade807cb068b0..53db80a58765e27ce970934ef22713910ce532f4 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 f5a2ae01f409b4d1747298a047468887d2c45d87..219119205e32d6036497540044a30f280811017f 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 14a60e813e974266ef746117cba80a3b8bec0658..f660fb00d7ab27b428de01ebb1fcb434d2d8123f 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 fe9d2e91772234b8c1db4154bed56a661c118c11..0ab58cfd6d5b89b1df2610144a5018770fa946a0 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) {