mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 01:48:00 +00:00
Windows: rethink API of write_aclip().
That clipboard-writing function is called just once, from the Event Log dialog procedure, for when the user deliberately copies to the clipboard. That call always passes must_deselect = true, which means the conditional WM_IGNORE_CLIP messages are not sent. So it's simpler to remove that parameter completely, and the conditional calls which are never used. Also, the clipboard data copied from the Event Log dialog is being put in the clipboard associated with the main PuTTY terminal window. But anything else we copy from a dialog box using Windows's built-in copy-paste mechanisms would surely be associated with the _dialog_, not its parent window. So we should do the same thing here. Therefore, I've added a HWND parameter to write_aclip() and used that in place of wgs.term_hwnd, so that we can pass in the HWND of the dialog itself.
This commit is contained in:
parent
260aad5fca
commit
307e909b51
@ -326,7 +326,7 @@ static INT_PTR CALLBACK LogProc(HWND hwnd, UINT msg,
|
||||
memcpy(p, sel_nl, sizeof(sel_nl));
|
||||
p += sizeof(sel_nl);
|
||||
}
|
||||
write_aclip(CLIP_SYSTEM, clipdata, size, true);
|
||||
write_aclip(hwnd, CLIP_SYSTEM, clipdata, size);
|
||||
sfree(clipdata);
|
||||
}
|
||||
sfree(selitems);
|
||||
|
@ -249,7 +249,7 @@ const SeatDialogPromptDescriptions *win_seat_prompt_descriptions(Seat *seat);
|
||||
* which takes the data string in the system code page instead of
|
||||
* Unicode.
|
||||
*/
|
||||
void write_aclip(int clipboard, char *, int, bool);
|
||||
void write_aclip(HWND hwnd, int clipboard, char *, int);
|
||||
|
||||
#define WM_NETEVENT (WM_APP + 5)
|
||||
|
||||
|
@ -4942,7 +4942,7 @@ static void wintw_palette_set(TermWin *win, unsigned start,
|
||||
}
|
||||
}
|
||||
|
||||
void write_aclip(int clipboard, char *data, int len, bool must_deselect)
|
||||
void write_aclip(HWND hwnd, int clipboard, char *data, int len)
|
||||
{
|
||||
HGLOBAL clipdata;
|
||||
void *lock;
|
||||
@ -4960,18 +4960,12 @@ void write_aclip(int clipboard, char *data, int len, bool must_deselect)
|
||||
((unsigned char *) lock)[len] = 0;
|
||||
GlobalUnlock(clipdata);
|
||||
|
||||
if (!must_deselect)
|
||||
SendMessage(wgs.term_hwnd, WM_IGNORE_CLIP, true, 0);
|
||||
|
||||
if (OpenClipboard(wgs.term_hwnd)) {
|
||||
if (OpenClipboard(hwnd)) {
|
||||
EmptyClipboard();
|
||||
SetClipboardData(CF_TEXT, clipdata);
|
||||
CloseClipboard();
|
||||
} else
|
||||
GlobalFree(clipdata);
|
||||
|
||||
if (!must_deselect)
|
||||
SendMessage(wgs.term_hwnd, WM_IGNORE_CLIP, false, 0);
|
||||
}
|
||||
|
||||
typedef struct _rgbindex {
|
||||
|
Loading…
Reference in New Issue
Block a user