Changeset - r24110:4ef53c5b9862
[Not reviewed]
master
0 1 0
LCD 47 - 5 years ago 2020-01-16 16:20:21
lcd047@gmail.com
Fix: [SDL2] support pasting from clipboard on Linux
1 file changed with 17 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/os/unix/unix.cpp
Show inline comments
 
@@ -21,12 +21,16 @@
 
#include <dirent.h>
 
#include <unistd.h>
 
#include <sys/stat.h>
 
#include <time.h>
 
#include <signal.h>
 

	
 
#ifdef WITH_SDL2
 
#include <SDL.h>
 
#endif
 

	
 
#ifdef __APPLE__
 
	#include <sys/mount.h>
 
#elif (defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L) || defined(__GLIBC__)
 
	#define HAS_STATVFS
 
#endif
 

	
 
@@ -263,12 +267,25 @@ int CDECL main(int argc, char *argv[])
 
	return ret;
 
}
 

	
 
#ifndef WITH_COCOA
 
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;
 
}
 
#endif
 

	
 

	
 
#ifndef __APPLE__
0 comments (0 inline, 0 general)