2018-10-21 23:28:24 +02:00
|
|
|
/*
|
|
|
|
vid_sdl.c - SDL input component
|
|
|
|
Copyright (C) 2018 a1batross
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
*/
|
2019-11-24 01:52:08 +01:00
|
|
|
#if !XASH_DEDICATED
|
2018-10-21 23:28:24 +02:00
|
|
|
#include <SDL.h>
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
#include "keydefs.h"
|
|
|
|
#include "input.h"
|
|
|
|
#include "client.h"
|
|
|
|
#include "vgui_draw.h"
|
|
|
|
#include "events.h"
|
|
|
|
#include "sound.h"
|
|
|
|
#include "vid_common.h"
|
|
|
|
|
2021-03-01 19:48:31 +01:00
|
|
|
SDL_Joystick *g_joy = NULL;
|
2021-01-02 03:08:32 +01:00
|
|
|
#if !SDL_VERSION_ATLEAST( 2, 0, 0 )
|
2019-10-25 16:11:27 +02:00
|
|
|
#define SDL_WarpMouseInWindow( win, x, y ) SDL_WarpMouse( ( x ), ( y ) )
|
2022-04-27 20:32:20 +02:00
|
|
|
#else
|
2022-05-30 02:33:03 +02:00
|
|
|
static struct
|
|
|
|
{
|
|
|
|
qboolean initialized;
|
|
|
|
SDL_Cursor *cursors[dc_last];
|
|
|
|
} cursors;
|
2019-10-25 16:11:27 +02:00
|
|
|
#endif
|
2018-10-21 23:28:24 +02:00
|
|
|
|
2018-10-22 00:09:43 +02:00
|
|
|
/*
|
|
|
|
=============
|
|
|
|
Platform_GetMousePos
|
|
|
|
|
|
|
|
=============
|
|
|
|
*/
|
2020-01-19 02:15:54 +01:00
|
|
|
void GAME_EXPORT Platform_GetMousePos( int *x, int *y )
|
2018-10-22 00:09:43 +02:00
|
|
|
{
|
|
|
|
SDL_GetMouseState( x, y );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
=============
|
|
|
|
Platform_SetMousePos
|
|
|
|
|
|
|
|
============
|
|
|
|
*/
|
2020-01-19 02:15:54 +01:00
|
|
|
void GAME_EXPORT Platform_SetMousePos( int x, int y )
|
2018-10-22 00:09:43 +02:00
|
|
|
{
|
|
|
|
SDL_WarpMouseInWindow( host.hWnd, x, y );
|
|
|
|
}
|
|
|
|
|
2020-08-21 12:39:01 +02:00
|
|
|
/*
|
|
|
|
========================
|
|
|
|
Platform_MouseMove
|
|
|
|
|
|
|
|
========================
|
|
|
|
*/
|
|
|
|
void Platform_MouseMove( float *x, float *y )
|
|
|
|
{
|
|
|
|
int m_x, m_y;
|
2020-08-24 17:43:15 +02:00
|
|
|
SDL_GetRelativeMouseState( &m_x, &m_y );
|
2020-08-21 12:39:01 +02:00
|
|
|
*x = (float)m_x;
|
|
|
|
*y = (float)m_y;
|
|
|
|
}
|
|
|
|
|
2018-10-22 00:25:29 +02:00
|
|
|
/*
|
|
|
|
=============
|
|
|
|
Platform_GetClipobardText
|
|
|
|
|
|
|
|
=============
|
|
|
|
*/
|
2022-04-22 19:28:19 +02:00
|
|
|
int Platform_GetClipboardText( char *buffer, size_t size )
|
2018-10-22 00:25:29 +02:00
|
|
|
{
|
2019-10-25 16:11:27 +02:00
|
|
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
2022-04-22 19:28:19 +02:00
|
|
|
int textLength;
|
2018-10-22 00:25:29 +02:00
|
|
|
char *sdlbuffer = SDL_GetClipboardText();
|
|
|
|
|
|
|
|
if( !sdlbuffer )
|
2022-04-22 19:28:19 +02:00
|
|
|
return 0;
|
2018-10-22 00:25:29 +02:00
|
|
|
|
2022-04-22 19:28:19 +02:00
|
|
|
if (buffer && size > 0)
|
|
|
|
{
|
|
|
|
textLength = Q_strncpy( buffer, sdlbuffer, size );
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
textLength = Q_strlen( sdlbuffer );
|
|
|
|
}
|
2018-10-22 00:25:29 +02:00
|
|
|
SDL_free( sdlbuffer );
|
2022-04-22 19:28:19 +02:00
|
|
|
return textLength;
|
2019-10-25 16:11:27 +02:00
|
|
|
#else // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
2019-10-24 11:43:17 +02:00
|
|
|
buffer[0] = 0;
|
2019-10-25 16:11:27 +02:00
|
|
|
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
2022-04-22 19:28:19 +02:00
|
|
|
return 0;
|
2018-10-22 00:25:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
=============
|
|
|
|
Platform_SetClipobardText
|
|
|
|
|
|
|
|
=============
|
|
|
|
*/
|
2022-04-22 19:28:19 +02:00
|
|
|
void Platform_SetClipboardText( const char *buffer )
|
2018-10-22 00:25:29 +02:00
|
|
|
{
|
2019-10-25 16:11:27 +02:00
|
|
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
2018-10-22 00:25:29 +02:00
|
|
|
SDL_SetClipboardText( buffer );
|
2019-10-25 16:11:27 +02:00
|
|
|
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
2018-10-22 00:25:29 +02:00
|
|
|
}
|
|
|
|
|
2018-10-21 23:28:24 +02:00
|
|
|
/*
|
|
|
|
=============
|
|
|
|
Platform_Vibrate
|
|
|
|
|
|
|
|
=============
|
|
|
|
*/
|
|
|
|
void Platform_Vibrate( float time, char flags )
|
|
|
|
{
|
2023-02-03 06:50:41 +01:00
|
|
|
if( g_joy )
|
|
|
|
SDL_JoystickRumble( g_joy, 0xFFFF, 0xFFFF, time * 1000.0f );
|
2018-10-21 23:28:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
=============
|
|
|
|
SDLash_EnableTextInput
|
|
|
|
|
|
|
|
=============
|
|
|
|
*/
|
|
|
|
void Platform_EnableTextInput( qboolean enable )
|
|
|
|
{
|
2019-10-25 16:11:27 +02:00
|
|
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
2018-10-21 23:28:24 +02:00
|
|
|
enable ? SDL_StartTextInput() : SDL_StopTextInput();
|
2019-10-25 16:11:27 +02:00
|
|
|
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
2018-10-21 23:28:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
=============
|
|
|
|
SDLash_JoyInit_Old
|
|
|
|
|
|
|
|
=============
|
|
|
|
*/
|
|
|
|
static int SDLash_JoyInit_Old( int numjoy )
|
|
|
|
{
|
|
|
|
int num;
|
|
|
|
int i;
|
|
|
|
|
2018-11-16 13:25:04 +01:00
|
|
|
Con_Reportf( "Joystick: SDL\n" );
|
2018-10-21 23:28:24 +02:00
|
|
|
|
|
|
|
if( SDL_WasInit( SDL_INIT_JOYSTICK ) != SDL_INIT_JOYSTICK &&
|
|
|
|
SDL_InitSubSystem( SDL_INIT_JOYSTICK ) )
|
|
|
|
{
|
2018-11-16 13:25:04 +01:00
|
|
|
Con_Reportf( "Failed to initialize SDL Joysitck: %s\n", SDL_GetError() );
|
2018-10-21 23:28:24 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-03-01 19:48:31 +01:00
|
|
|
if( g_joy )
|
2018-10-21 23:28:24 +02:00
|
|
|
{
|
2021-03-01 19:48:31 +01:00
|
|
|
SDL_JoystickClose( g_joy );
|
2018-10-21 23:28:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
num = SDL_NumJoysticks();
|
|
|
|
|
|
|
|
if( num > 0 )
|
2018-11-16 13:25:04 +01:00
|
|
|
Con_Reportf( "%i joysticks found:\n", num );
|
2018-10-21 23:28:24 +02:00
|
|
|
else
|
|
|
|
{
|
2018-11-16 13:25:04 +01:00
|
|
|
Con_Reportf( "No joystick found.\n" );
|
2018-10-21 23:28:24 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-10-25 16:11:27 +02:00
|
|
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
2018-10-21 23:28:24 +02:00
|
|
|
for( i = 0; i < num; i++ )
|
2018-11-16 13:25:04 +01:00
|
|
|
Con_Reportf( "%i\t: %s\n", i, SDL_JoystickNameForIndex( i ) );
|
2019-10-25 16:11:27 +02:00
|
|
|
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
2018-10-21 23:28:24 +02:00
|
|
|
|
2018-11-16 13:25:04 +01:00
|
|
|
Con_Reportf( "Pass +set joy_index N to command line, where N is number, to select active joystick\n" );
|
2018-10-21 23:28:24 +02:00
|
|
|
|
2021-03-01 19:48:31 +01:00
|
|
|
g_joy = SDL_JoystickOpen( numjoy );
|
2018-10-21 23:28:24 +02:00
|
|
|
|
2021-03-01 19:48:31 +01:00
|
|
|
if( !g_joy )
|
2018-10-21 23:28:24 +02:00
|
|
|
{
|
2018-11-16 13:25:04 +01:00
|
|
|
Con_Reportf( "Failed to select joystick: %s\n", SDL_GetError( ) );
|
2018-10-21 23:28:24 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-10-25 16:11:27 +02:00
|
|
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
2018-11-16 13:25:04 +01:00
|
|
|
Con_Reportf( "Selected joystick: %s\n"
|
2018-10-21 23:28:24 +02:00
|
|
|
"\tAxes: %i\n"
|
|
|
|
"\tHats: %i\n"
|
|
|
|
"\tButtons: %i\n"
|
|
|
|
"\tBalls: %i\n",
|
2021-03-01 19:48:31 +01:00
|
|
|
SDL_JoystickName( g_joy ), SDL_JoystickNumAxes( g_joy ), SDL_JoystickNumHats( g_joy ),
|
|
|
|
SDL_JoystickNumButtons( g_joy ), SDL_JoystickNumBalls( g_joy ) );
|
2018-10-21 23:28:24 +02:00
|
|
|
|
|
|
|
SDL_GameControllerEventState( SDL_DISABLE );
|
2019-10-25 16:11:27 +02:00
|
|
|
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
2018-10-21 23:28:24 +02:00
|
|
|
SDL_JoystickEventState( SDL_ENABLE );
|
|
|
|
|
|
|
|
return num;
|
|
|
|
}
|
|
|
|
|
2019-10-25 16:11:27 +02:00
|
|
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
2018-10-21 23:28:24 +02:00
|
|
|
/*
|
|
|
|
=============
|
|
|
|
SDLash_JoyInit_New
|
|
|
|
|
|
|
|
=============
|
|
|
|
*/
|
|
|
|
static int SDLash_JoyInit_New( int numjoy )
|
|
|
|
{
|
2021-01-02 03:08:32 +01:00
|
|
|
int count, numJoysticks, i;
|
2018-10-21 23:28:24 +02:00
|
|
|
|
2018-11-16 13:25:04 +01:00
|
|
|
Con_Reportf( "Joystick: SDL GameController API\n" );
|
2018-10-21 23:28:24 +02:00
|
|
|
if( SDL_WasInit( SDL_INIT_GAMECONTROLLER ) != SDL_INIT_GAMECONTROLLER &&
|
|
|
|
SDL_InitSubSystem( SDL_INIT_GAMECONTROLLER ) )
|
|
|
|
{
|
2018-11-16 13:25:04 +01:00
|
|
|
Con_Reportf( "Failed to initialize SDL GameController API: %s\n", SDL_GetError() );
|
2018-10-21 23:28:24 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
SDL_GameControllerAddMappingsFromFile( "controllermappings.txt" );
|
|
|
|
|
2021-01-02 03:08:32 +01:00
|
|
|
count = 0;
|
|
|
|
numJoysticks = SDL_NumJoysticks();
|
|
|
|
for ( i = 0; i < numJoysticks; i++ )
|
|
|
|
if( SDL_IsGameController( i ) )
|
|
|
|
++count;
|
2018-10-21 23:28:24 +02:00
|
|
|
|
2021-01-02 03:08:32 +01:00
|
|
|
return count;
|
2018-10-21 23:28:24 +02:00
|
|
|
}
|
2019-10-25 16:11:27 +02:00
|
|
|
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
2018-10-21 23:28:24 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
=============
|
|
|
|
Platform_JoyInit
|
|
|
|
|
|
|
|
=============
|
|
|
|
*/
|
|
|
|
int Platform_JoyInit( int numjoy )
|
|
|
|
{
|
2019-10-25 16:11:27 +02:00
|
|
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
2018-10-21 23:28:24 +02:00
|
|
|
// SDL_Joystick is now an old API
|
|
|
|
// SDL_GameController is preferred
|
2019-10-24 11:43:17 +02:00
|
|
|
if( !Sys_CheckParm( "-sdl_joy_old_api" ) )
|
|
|
|
return SDLash_JoyInit_New(numjoy);
|
2019-10-25 16:11:27 +02:00
|
|
|
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
2019-10-24 11:43:17 +02:00
|
|
|
return SDLash_JoyInit_Old(numjoy);
|
2018-10-21 23:28:24 +02:00
|
|
|
}
|
|
|
|
|
2022-04-22 19:31:10 +02:00
|
|
|
/*
|
|
|
|
========================
|
|
|
|
SDLash_InitCursors
|
|
|
|
|
|
|
|
========================
|
|
|
|
*/
|
2022-05-30 02:33:03 +02:00
|
|
|
void SDLash_InitCursors( void )
|
2022-04-22 19:31:10 +02:00
|
|
|
{
|
2022-06-13 03:27:54 +02:00
|
|
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
2022-05-30 02:33:03 +02:00
|
|
|
if( cursors.initialized )
|
|
|
|
SDLash_FreeCursors();
|
|
|
|
|
|
|
|
// load up all default cursors
|
|
|
|
cursors.cursors[dc_none] = NULL;
|
|
|
|
cursors.cursors[dc_arrow] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW);
|
|
|
|
cursors.cursors[dc_ibeam] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_IBEAM);
|
|
|
|
cursors.cursors[dc_hourglass] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_WAIT);
|
|
|
|
cursors.cursors[dc_crosshair] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_CROSSHAIR);
|
|
|
|
cursors.cursors[dc_up] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW);
|
|
|
|
cursors.cursors[dc_sizenwse] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENWSE);
|
|
|
|
cursors.cursors[dc_sizenesw] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENESW);
|
|
|
|
cursors.cursors[dc_sizewe] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZEWE);
|
|
|
|
cursors.cursors[dc_sizens] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENS);
|
|
|
|
cursors.cursors[dc_sizeall] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZEALL);
|
|
|
|
cursors.cursors[dc_no] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_NO);
|
|
|
|
cursors.cursors[dc_hand] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_HAND);
|
|
|
|
cursors.initialized = true;
|
2022-06-13 03:27:54 +02:00
|
|
|
#endif
|
2022-05-30 02:33:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
SDLash_FreeCursors
|
|
|
|
|
|
|
|
========================
|
|
|
|
*/
|
|
|
|
void SDLash_FreeCursors( void )
|
|
|
|
{
|
|
|
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
for( ; i < ARRAYSIZE( cursors.cursors ); i++ )
|
|
|
|
{
|
|
|
|
if( cursors.cursors[i] )
|
|
|
|
SDL_FreeCursor( cursors.cursors[i] );
|
|
|
|
cursors.cursors[i] = NULL;
|
2022-04-22 19:31:10 +02:00
|
|
|
}
|
2022-05-30 02:33:03 +02:00
|
|
|
|
|
|
|
cursors.initialized = false;
|
|
|
|
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
2022-04-22 19:31:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
Platform_SetCursorType
|
|
|
|
|
|
|
|
========================
|
|
|
|
*/
|
2022-04-27 20:32:20 +02:00
|
|
|
void Platform_SetCursorType( VGUI_DefaultCursor type )
|
2022-04-22 19:31:10 +02:00
|
|
|
{
|
|
|
|
qboolean visible;
|
|
|
|
|
2022-06-13 03:27:54 +02:00
|
|
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
2022-05-30 02:33:03 +02:00
|
|
|
if( !cursors.initialized )
|
2022-04-22 19:31:10 +02:00
|
|
|
return;
|
2022-06-13 03:27:54 +02:00
|
|
|
#endif
|
2022-04-22 19:31:10 +02:00
|
|
|
|
|
|
|
switch( type )
|
|
|
|
{
|
2022-04-27 20:32:20 +02:00
|
|
|
case dc_user:
|
|
|
|
case dc_none:
|
2022-04-22 19:31:10 +02:00
|
|
|
visible = false;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
visible = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2022-10-12 04:18:19 +02:00
|
|
|
// never disable cursor in touch emulation mode
|
|
|
|
if( !visible && touch_emulate.value )
|
2022-04-22 19:31:10 +02:00
|
|
|
return;
|
|
|
|
|
2022-10-12 04:18:19 +02:00
|
|
|
host.mouse_visible = visible;
|
2022-11-08 01:03:50 +01:00
|
|
|
VGui_UpdateInternalCursorState( type );
|
2022-10-12 04:18:19 +02:00
|
|
|
|
2022-06-13 03:27:54 +02:00
|
|
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
2022-07-08 23:21:42 +02:00
|
|
|
if( host.mouse_visible )
|
2022-04-22 19:31:10 +02:00
|
|
|
{
|
2022-05-30 02:33:03 +02:00
|
|
|
SDL_SetCursor( cursors.cursors[type] );
|
2022-04-22 19:31:10 +02:00
|
|
|
SDL_ShowCursor( true );
|
|
|
|
}
|
2022-07-08 23:21:42 +02:00
|
|
|
else
|
2022-04-22 19:31:10 +02:00
|
|
|
{
|
|
|
|
SDL_ShowCursor( false );
|
|
|
|
}
|
2022-06-13 03:27:54 +02:00
|
|
|
#else
|
2022-07-08 23:21:42 +02:00
|
|
|
if( host.mouse_visible )
|
2022-06-13 03:27:54 +02:00
|
|
|
{
|
|
|
|
SDL_ShowCursor( true );
|
|
|
|
}
|
2022-07-08 23:21:42 +02:00
|
|
|
else
|
2022-06-13 03:27:54 +02:00
|
|
|
{
|
|
|
|
SDL_ShowCursor( false );
|
|
|
|
}
|
2022-04-22 19:31:10 +02:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-04-22 19:33:07 +02:00
|
|
|
/*
|
|
|
|
========================
|
|
|
|
Platform_GetKeyModifiers
|
|
|
|
|
|
|
|
========================
|
|
|
|
*/
|
|
|
|
key_modifier_t Platform_GetKeyModifiers( void )
|
|
|
|
{
|
2022-04-27 21:09:20 +02:00
|
|
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
2022-04-22 19:33:07 +02:00
|
|
|
SDL_Keymod modFlags;
|
|
|
|
key_modifier_t resultFlags;
|
|
|
|
|
|
|
|
resultFlags = KeyModifier_None;
|
|
|
|
modFlags = SDL_GetModState();
|
|
|
|
if( FBitSet( modFlags, KMOD_LCTRL ))
|
|
|
|
SetBits( resultFlags, KeyModifier_LeftCtrl );
|
|
|
|
if( FBitSet( modFlags, KMOD_RCTRL ))
|
|
|
|
SetBits( resultFlags, KeyModifier_RightCtrl );
|
|
|
|
if( FBitSet( modFlags, KMOD_RSHIFT ))
|
|
|
|
SetBits( resultFlags, KeyModifier_RightShift );
|
|
|
|
if( FBitSet( modFlags, KMOD_LSHIFT ))
|
|
|
|
SetBits( resultFlags, KeyModifier_LeftShift );
|
|
|
|
if( FBitSet( modFlags, KMOD_LALT ))
|
|
|
|
SetBits( resultFlags, KeyModifier_LeftAlt );
|
|
|
|
if( FBitSet( modFlags, KMOD_RALT ))
|
|
|
|
SetBits( resultFlags, KeyModifier_RightAlt );
|
|
|
|
if( FBitSet( modFlags, KMOD_NUM ))
|
|
|
|
SetBits( resultFlags, KeyModifier_NumLock );
|
|
|
|
if( FBitSet( modFlags, KMOD_CAPS ))
|
|
|
|
SetBits( resultFlags, KeyModifier_CapsLock );
|
|
|
|
if( FBitSet( modFlags, KMOD_RGUI ))
|
|
|
|
SetBits( resultFlags, KeyModifier_RightSuper );
|
|
|
|
if( FBitSet( modFlags, KMOD_LGUI ))
|
|
|
|
SetBits( resultFlags, KeyModifier_LeftSuper );
|
|
|
|
|
|
|
|
return resultFlags;
|
2022-04-27 21:09:20 +02:00
|
|
|
#else
|
|
|
|
return KeyModifier_None;
|
|
|
|
#endif
|
2022-04-22 19:33:07 +02:00
|
|
|
}
|
|
|
|
|
2018-10-21 23:28:24 +02:00
|
|
|
#endif // XASH_DEDICATED
|