mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 15:31:39 +00:00
pl_linux.c: implement PL_GetClipboardData using SDL2
git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@1005 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
57294d262d
commit
d7fb4c3d00
1 changed files with 23 additions and 1 deletions
|
@ -22,7 +22,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "quakedef.h"
|
||||
#if defined(SDL_FRAMEWORK) || defined(NO_SDL_CONFIG)
|
||||
#if defined(USE_SDL2)
|
||||
#include <SDL2/SDL.h>
|
||||
#else
|
||||
#include <SDL/SDL.h>
|
||||
#endif
|
||||
#else
|
||||
#include "SDL.h"
|
||||
#endif
|
||||
|
@ -61,9 +65,27 @@ void PL_VID_Shutdown (void)
|
|||
{
|
||||
}
|
||||
|
||||
#define MAX_CLIPBOARDTXT MAXCMDLINE /* 256 */
|
||||
char *PL_GetClipboardData (void)
|
||||
{
|
||||
return NULL;
|
||||
char *data = NULL;
|
||||
#if defined(USE_SDL2)
|
||||
char *cliptext = SDL_GetClipboardText();
|
||||
|
||||
if (cliptext != NULL)
|
||||
{
|
||||
size_t size = strlen(cliptext) + 1;
|
||||
/* this is intended for simple small text copies
|
||||
* such as an ip address, etc: do chop the size
|
||||
* here, otherwise we may experience Z_Malloc()
|
||||
* failures and all other not-oh-so-fun stuff. */
|
||||
size = q_min(MAX_CLIPBOARDTXT, size);
|
||||
data = (char *) Z_Malloc(size);
|
||||
q_strlcpy (data, cliptext, size);
|
||||
}
|
||||
#endif
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void PL_ErrorDialog (const char *errorMsg)
|
||||
|
|
Loading…
Reference in a new issue