1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 01:48:00 +00:00

Add a parameter to write_clip() so that windlg.c need not call term_deselect

[originally from svn r681]
This commit is contained in:
Simon Tatham 2000-10-06 12:32:25 +00:00
parent bbe7ece71f
commit 7b6106d62a
6 changed files with 22 additions and 10 deletions

View File

@ -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;

View File

@ -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 *, ...);

2
scp.c
View File

@ -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 */

View 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;

View File

@ -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;

View File

@ -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) {