Skip to content

Commit

Permalink
Get the initial clipboard state at startup
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jan 1, 2025
1 parent d84fd86 commit 3e62517
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/video/cocoa/SDL_cocoaclipboard.m
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ void Cocoa_CheckClipboardUpdate(SDL_CocoaVideoData *data)
pasteboard = [NSPasteboard generalPasteboard];
count = [pasteboard changeCount];
if (count != data.clipboard_count) {
if (data.clipboard_count) {
if (count) {
int nformats = 0;
char **new_mime_types = GetMimeTypes(&nformats);
if (new_mime_types) {
Expand Down
9 changes: 4 additions & 5 deletions src/video/windows/SDL_windowsclipboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,17 +426,16 @@ static char **GetMimeTypes(int *pnformats)

void WIN_CheckClipboardUpdate(struct SDL_VideoData *data)
{
const DWORD seq = GetClipboardSequenceNumber();
if (seq != data->clipboard_count) {
if (data->clipboard_count) {
DWORD count = GetClipboardSequenceNumber();
if (count != data->clipboard_count) {
if (count) {
int nformats = 0;
char **new_mime_types = GetMimeTypes(&nformats);
if (new_mime_types) {
SDL_SendClipboardUpdate(false, new_mime_types, nformats);
}
}

data->clipboard_count = seq;
data->clipboard_count = count;
}
}

Expand Down

0 comments on commit 3e62517

Please sign in to comment.