mirror of https://github.com/FWGS/xash3d-fwgs
platform: add Set/GetClipboardText calls. Remove unneeded SDL_SetHint call on Android, because Android does not use SDL anymore
This commit is contained in:
parent
96e0167e47
commit
90d2434bb0
|
@ -907,9 +907,6 @@ void IN_TouchInit( void )
|
||||||
|
|
||||||
// input devices cvar
|
// input devices cvar
|
||||||
touch_enable = Cvar_Get( "touch_enable", DEFAULT_TOUCH_ENABLE, FCVAR_ARCHIVE, "enable touch controls" );
|
touch_enable = Cvar_Get( "touch_enable", DEFAULT_TOUCH_ENABLE, FCVAR_ARCHIVE, "enable touch controls" );
|
||||||
#if defined(XASH_SDL) && defined(__ANDROID__)
|
|
||||||
SDL_SetHint( SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH, "1" );
|
|
||||||
#endif
|
|
||||||
touch.initialized = true;
|
touch.initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ GNU General Public License for more details.
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "mathlib.h"
|
#include "mathlib.h"
|
||||||
|
#include "platform/platform.h"
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
@ -157,18 +158,10 @@ create buffer, that contain clipboard
|
||||||
char *Sys_GetClipboardData( void )
|
char *Sys_GetClipboardData( void )
|
||||||
{
|
{
|
||||||
static char data[1024];
|
static char data[1024];
|
||||||
char *cliptext;
|
|
||||||
|
|
||||||
data[0] = '\0';
|
data[0] = '\0';
|
||||||
|
|
||||||
#ifdef XASH_SDL
|
Platform_GetClipboardText( data, sizeof( data ));
|
||||||
cliptext = SDL_GetClipboardText();
|
|
||||||
if( cliptext )
|
|
||||||
{
|
|
||||||
Q_strncpy( data, cliptext, sizeof( data ) );
|
|
||||||
SDL_free( cliptext );
|
|
||||||
}
|
|
||||||
#endif // XASH_SDL
|
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
@ -182,9 +175,7 @@ write screenshot into clipboard
|
||||||
*/
|
*/
|
||||||
void Sys_SetClipboardData( const byte *buffer, size_t size )
|
void Sys_SetClipboardData( const byte *buffer, size_t size )
|
||||||
{
|
{
|
||||||
#ifdef XASH_SDL
|
Platform_SetClipboardText( (char *)buffer, size );
|
||||||
SDL_SetClipboardText((char *)buffer);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -43,6 +43,9 @@ void Platform_RunEvents( void );
|
||||||
// Mouse
|
// Mouse
|
||||||
void Platform_GetMousePos( int *x, int *y );
|
void Platform_GetMousePos( int *x, int *y );
|
||||||
void Platform_SetMousePos( int x, int y );
|
void Platform_SetMousePos( int x, int y );
|
||||||
|
// Clipboard
|
||||||
|
void Platform_GetClipboardText( char *buffer, size_t size );
|
||||||
|
void Platform_SetClipboardText( char *buffer, size_t size );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
|
@ -50,6 +50,34 @@ void Platform_SetMousePos( int x, int y )
|
||||||
SDL_WarpMouseInWindow( host.hWnd, x, y );
|
SDL_WarpMouseInWindow( host.hWnd, x, y );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
Platform_GetClipobardText
|
||||||
|
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
void Platform_GetClipboardText( char *buffer, size_t size )
|
||||||
|
{
|
||||||
|
char *sdlbuffer = SDL_GetClipboardText();
|
||||||
|
|
||||||
|
if( !sdlbuffer )
|
||||||
|
return;
|
||||||
|
|
||||||
|
Q_strncpy( buffer, sdlbuffer, size );
|
||||||
|
SDL_free( sdlbuffer );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
Platform_SetClipobardText
|
||||||
|
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
void Platform_SetClipboardText( char *buffer, size_t size )
|
||||||
|
{
|
||||||
|
SDL_SetClipboardText( buffer );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
Platform_Vibrate
|
Platform_Vibrate
|
||||||
|
|
Loading…
Reference in New Issue