diff --git a/engine/client/in_touch.c b/engine/client/in_touch.c index 21cf799e..6e44a74b 100644 --- a/engine/client/in_touch.c +++ b/engine/client/in_touch.c @@ -163,8 +163,8 @@ static CVAR_DEFINE_AUTO( touch_dpad_radius, "1.0", FCVAR_FILTERABLE, "dpad radiu static CVAR_DEFINE_AUTO( touch_joy_radius, "1.0", FCVAR_FILTERABLE, "joy radius multiplier" ); static CVAR_DEFINE_AUTO( touch_move_indicator, "0.0", FCVAR_FILTERABLE, "indicate move events (0 to disable)" ); static CVAR_DEFINE_AUTO( touch_joy_texture, "touch_default/joy", FCVAR_FILTERABLE, "texture for move indicator"); +static CVAR_DEFINE_AUTO( touch_emulate, "0", FCVAR_ARCHIVE | FCVAR_FILTERABLE, "emulate touch with mouse" ); CVAR_DEFINE_AUTO( touch_enable, DEFAULT_TOUCH_ENABLE, FCVAR_ARCHIVE | FCVAR_FILTERABLE, "enable touch controls" ); -CVAR_DEFINE_AUTO( touch_emulate, "0", FCVAR_ARCHIVE | FCVAR_FILTERABLE, "emulate touch with mouse" ); // code looks smaller with it #define B(x) (button->x) @@ -2122,7 +2122,7 @@ void Touch_KeyEvent( int key, int down ) float x, y; int finger, xi, yi; - if( !touch_emulate.value ) + if( !Touch_Emulated( )) { if( touch_enable.value ) return; @@ -2176,6 +2176,11 @@ qboolean Touch_WantVisibleCursor( void ) return ( touch_enable.value && touch_emulate.value ) || touch.clientonly; } +qboolean Touch_Emulated( void ) +{ + return touch_emulate.value || touch_in_menu.value; +} + void Touch_Shutdown( void ) { if( !touch.initialized ) diff --git a/engine/client/input.c b/engine/client/input.c index 4674c546..aa903e27 100644 --- a/engine/client/input.c +++ b/engine/client/input.c @@ -316,7 +316,7 @@ static void IN_MouseMove( void ) if( !in_mouseinitialized ) return; - if( touch_emulate.value ) + if( Touch_Emulated( )) { // touch emulation overrides all input Touch_KeyEvent( 0, 0 ); @@ -347,7 +347,7 @@ void IN_MouseEvent( int key, int down ) else ClearBits( in_mstate, BIT( key )); // touch emulation overrides all input - if( touch_emulate.value ) + if( Touch_Emulated( )) { Touch_KeyEvent( K_MOUSE1 + key, down ); } diff --git a/engine/client/input.h b/engine/client/input.h index fc126ea4..5ab99a0b 100644 --- a/engine/client/input.h +++ b/engine/client/input.h @@ -58,7 +58,6 @@ typedef enum } touchEventType; extern convar_t touch_enable; -extern convar_t touch_emulate; void Touch_Draw( void ); void Touch_SetClientOnly( byte state ); @@ -74,6 +73,7 @@ void Touch_ResetDefaultButtons( void ); int IN_TouchEvent( touchEventType type, int fingerID, float x, float y, float dx, float dy ); void Touch_KeyEvent( int key, int down ); qboolean Touch_WantVisibleCursor( void ); +qboolean Touch_Emulated( void ); void Touch_NotifyResize( void ); // diff --git a/engine/platform/sdl/in_sdl.c b/engine/platform/sdl/in_sdl.c index 9301d267..1dcc9573 100644 --- a/engine/platform/sdl/in_sdl.c +++ b/engine/platform/sdl/in_sdl.c @@ -350,7 +350,7 @@ void Platform_SetCursorType( VGUI_DefaultCursor type ) } // never disable cursor in touch emulation mode - if( !visible && touch_emulate.value ) + if( !visible && Touch_Emulated( )) return; host.mouse_visible = visible;