diff --git a/engine/client/in_touch.c b/engine/client/in_touch.c index 4c219a63..fe58049d 100644 --- a/engine/client/in_touch.c +++ b/engine/client/in_touch.c @@ -907,9 +907,6 @@ void IN_TouchInit( void ) // input devices cvar 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; } diff --git a/engine/common/system.c b/engine/common/system.c index 3b02986a..f9072534 100644 --- a/engine/common/system.c +++ b/engine/common/system.c @@ -15,6 +15,7 @@ GNU General Public License for more details. #include "common.h" #include "mathlib.h" +#include "platform/platform.h" #include #include @@ -157,18 +158,10 @@ create buffer, that contain clipboard char *Sys_GetClipboardData( void ) { static char data[1024]; - char *cliptext; data[0] = '\0'; -#ifdef XASH_SDL - cliptext = SDL_GetClipboardText(); - if( cliptext ) - { - Q_strncpy( data, cliptext, sizeof( data ) ); - SDL_free( cliptext ); - } -#endif // XASH_SDL + Platform_GetClipboardText( data, sizeof( data )); return data; } @@ -182,9 +175,7 @@ write screenshot into clipboard */ void Sys_SetClipboardData( const byte *buffer, size_t size ) { -#ifdef XASH_SDL - SDL_SetClipboardText((char *)buffer); -#endif + Platform_SetClipboardText( (char *)buffer, size ); } /* diff --git a/engine/platform/platform.h b/engine/platform/platform.h index 69362bd4..fc941952 100644 --- a/engine/platform/platform.h +++ b/engine/platform/platform.h @@ -43,6 +43,9 @@ void Platform_RunEvents( void ); // Mouse void Platform_GetMousePos( 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 ); /* ============================================================================== diff --git a/engine/platform/sdl/in_sdl.c b/engine/platform/sdl/in_sdl.c index ad075838..b6d7d431 100644 --- a/engine/platform/sdl/in_sdl.c +++ b/engine/platform/sdl/in_sdl.c @@ -50,6 +50,34 @@ void Platform_SetMousePos( int x, int 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