# HG changeset patch # User sheepluva # Date 1447191474 -3600 # Node ID b0df3f2fcafcdba63eb7e2f049bf47e25834c300 # Parent 9006e158a81f40f9b9083705ad76a6e82929b4ec use SDL2 to copy to clipboard diff -r 9006e158a81f -r b0df3f2fcafc QTfrontend/game.cpp --- a/QTfrontend/game.cpp Tue Nov 10 22:18:06 2015 +0100 +++ b/QTfrontend/game.cpp Tue Nov 10 22:37:54 2015 +0100 @@ -17,7 +17,6 @@ */ #include -#include #include #include @@ -261,12 +260,6 @@ .arg(QString::fromUtf8(msg.mid(2).left(size - 4)))); return; } - case 'y': - { - // copy string to clipboard - QApplication::clipboard()->setText(QString::fromUtf8(msg.mid(2))); - break; - } case 'i': { emit GameStats(msg.at(2), QString::fromUtf8(msg.mid(3))); diff -r 9006e158a81f -r b0df3f2fcafc hedgewars/SDLh.pas --- a/hedgewars/SDLh.pas Tue Nov 10 22:18:06 2015 +0100 +++ b/hedgewars/SDLh.pas Tue Nov 10 22:37:54 2015 +0100 @@ -990,7 +990,10 @@ // SDL 2 clipboard functions function SDL_HasClipboardText(): Boolean; cdecl; external SDLLibName; +// returns nil if memory for clipboard contents copy couldn't be allocated function SDL_GetClipboardText(): PChar; cdecl; external SDLLibName; +// returns 0 on success or negative error number on failure +function SDL_SetClipboardText(const text: PChar): LongInt; cdecl; external SDLLibName; procedure SDLNet_Write16(value: Word; buf: Pointer); procedure SDLNet_Write32(value: LongWord; buf: Pointer); diff -r 9006e158a81f -r b0df3f2fcafc hedgewars/uChat.pas --- a/hedgewars/uChat.pas Tue Nov 10 22:18:06 2015 +0100 +++ b/hedgewars/uChat.pas Tue Nov 10 22:37:54 2015 +0100 @@ -726,7 +726,8 @@ procedure CopyToClipboard(var newContent: shortstring); begin - SendIPC(_S'y' + copy(newContent, 1, 253) + #0); + // SDL2 clipboard + SDL_SetClipboardText(Str2PChar(newContent)); end; procedure CopySelectionToClipboard();