mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-12 18:40:29 +00:00
Fix: [SDL2] support pasting from clipboard on Linux
This commit is contained in:
parent
87909855c8
commit
7f693ce497
@ -24,6 +24,10 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
|
#ifdef WITH_SDL2
|
||||||
|
#include <SDL.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
#elif (defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L) || defined(__GLIBC__)
|
#elif (defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L) || defined(__GLIBC__)
|
||||||
@ -266,6 +270,19 @@ int CDECL main(int argc, char *argv[])
|
|||||||
#ifndef WITH_COCOA
|
#ifndef WITH_COCOA
|
||||||
bool GetClipboardContents(char *buffer, const char *last)
|
bool GetClipboardContents(char *buffer, const char *last)
|
||||||
{
|
{
|
||||||
|
#ifdef WITH_SDL2
|
||||||
|
if (SDL_HasClipboardText() == SDL_FALSE) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *clip = SDL_GetClipboardText();
|
||||||
|
if (clip != NULL) {
|
||||||
|
strecpy(buffer, clip, last);
|
||||||
|
SDL_free(clip);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user