This repository has been archived on 2022-06-27. You can view files and clone it, but cannot push or open issues or pull requests.
Xash3DArchive/engine/common/input.c

603 lines
13 KiB
C
Raw Normal View History

2011-05-09 22:00:00 +02:00
/*
input.c - win32 input devices
Copyright (C) 2007 Uncle Mike
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.
*/
2008-07-06 22:00:00 +02:00
#include "common.h"
2008-08-04 22:00:00 +02:00
#include "input.h"
2008-07-06 22:00:00 +02:00
#include "client.h"
2011-03-19 22:00:00 +01:00
#include "vgui_draw.h"
2010-09-16 22:00:00 +02:00
2012-01-27 21:00:00 +01:00
#define PRINTSCREEN_ID 1
2010-01-02 22:00:00 +01:00
#define WND_HEADSIZE wnd_caption // some offset
#define WND_BORDER 3 // sentinel border in pixels
2010-01-01 22:00:00 +01:00
2011-04-01 22:00:00 +02:00
HICON in_mousecursor;
2012-12-21 21:00:00 +01:00
qboolean in_mouseactive; // false when not focus app
2010-10-26 22:00:00 +02:00
qboolean in_restore_spi;
qboolean in_mouseinitialized;
2010-06-17 22:00:00 +02:00
int in_mouse_oldbuttonstate;
2010-10-26 22:00:00 +02:00
qboolean in_mouse_suspended;
2018-03-20 22:00:00 +01:00
qboolean in_mouse_savedpos;
2010-01-01 22:00:00 +01:00
int in_mouse_buttons;
2010-01-02 22:00:00 +01:00
RECT window_rect, real_rect;
2018-03-20 22:00:00 +01:00
POINT in_lastvalidpos;
2010-01-01 22:00:00 +01:00
uint in_mouse_wheel;
2010-01-02 22:00:00 +01:00
int wnd_caption;
2008-07-06 22:00:00 +02:00
2008-08-04 22:00:00 +02:00
static byte scan_to_key[128] =
{
0,27,'1','2','3','4','5','6','7','8','9','0','-','=',K_BACKSPACE,9,
'q','w','e','r','t','y','u','i','o','p','[',']', 13 , K_CTRL,
'a','s','d','f','g','h','j','k','l',';','\'','`',
K_SHIFT,'\\','z','x','c','v','b','n','m',',','.','/',K_SHIFT,
'*',K_ALT,' ',K_CAPSLOCK,
K_F1,K_F2,K_F3,K_F4,K_F5,K_F6,K_F7,K_F8,K_F9,K_F10,
2018-10-16 23:00:00 +02:00
K_PAUSE,K_SCROLLOCK,K_HOME,K_UPARROW,K_PGUP,K_KP_MINUS,K_LEFTARROW,K_KP_5,
2008-08-04 22:00:00 +02:00
K_RIGHTARROW,K_KP_PLUS,K_END,K_DOWNARROW,K_PGDN,K_INS,K_DEL,
0,0,0,K_F11,K_F12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
};
2010-09-16 22:00:00 +02:00
// extra mouse buttons
static int mouse_buttons[] =
{
MK_LBUTTON,
MK_RBUTTON,
MK_MBUTTON,
MK_XBUTTON1,
MK_XBUTTON2,
MK_XBUTTON3,
MK_XBUTTON4,
MK_XBUTTON5
};
2008-08-04 22:00:00 +02:00
/*
=======
Host_MapKey
Map from windows to engine keynums
=======
*/
static int Host_MapKey( int key )
{
int result, modified;
2010-10-26 22:00:00 +02:00
qboolean is_extended = false;
2008-08-04 22:00:00 +02:00
modified = ( key >> 16 ) & 255;
if( modified > 127 ) return 0;
2010-02-18 22:00:00 +01:00
if( key & ( 1 << 24 ))
2008-08-04 22:00:00 +02:00
is_extended = true;
result = scan_to_key[modified];
if( !is_extended )
{
2010-06-17 22:00:00 +02:00
switch( result )
2008-08-04 22:00:00 +02:00
{
case K_HOME: return K_KP_HOME;
case K_UPARROW: return K_KP_UPARROW;
case K_PGUP: return K_KP_PGUP;
case K_LEFTARROW: return K_KP_LEFTARROW;
case K_RIGHTARROW: return K_KP_RIGHTARROW;
case K_END: return K_KP_END;
case K_DOWNARROW: return K_KP_DOWNARROW;
case K_PGDN: return K_KP_PGDN;
case K_INS: return K_KP_INS;
case K_DEL: return K_KP_DEL;
default: return result;
}
}
else
{
2010-06-17 22:00:00 +02:00
switch( result )
2008-08-04 22:00:00 +02:00
{
case K_PAUSE: return K_KP_NUMLOCK;
case 0x0D: return K_KP_ENTER;
case 0x2F: return K_KP_SLASH;
case 0xAF: return K_KP_PLUS;
2016-11-19 22:00:00 +01:00
default: return result;
2008-08-04 22:00:00 +02:00
}
}
}
2008-07-06 22:00:00 +02:00
/*
===========
IN_StartupMouse
===========
*/
void IN_StartupMouse( void )
{
2010-05-22 22:00:00 +02:00
if( host.type == HOST_DEDICATED ) return;
2011-03-08 22:00:00 +01:00
if( Sys_CheckParm( "-nomouse" )) return;
2008-07-06 22:00:00 +02:00
2010-09-16 22:00:00 +02:00
in_mouse_buttons = 8;
2008-07-06 22:00:00 +02:00
in_mouseinitialized = true;
2009-02-02 22:00:00 +01:00
in_mouse_wheel = RegisterWindowMessage( "MSWHEEL_ROLLMSG" );
2008-07-06 22:00:00 +02:00
}
2010-10-26 22:00:00 +02:00
static qboolean IN_CursorInRect( void )
2010-01-01 22:00:00 +01:00
{
POINT curpos;
if( !in_mouseinitialized || !in_mouseactive )
return false;
// find mouse movement
GetCursorPos( &curpos );
2010-01-02 22:00:00 +01:00
if( curpos.x < real_rect.left + WND_BORDER )
2010-01-01 22:00:00 +01:00
return false;
2010-01-02 22:00:00 +01:00
if( curpos.x > real_rect.right - WND_BORDER * 3 )
2010-01-01 22:00:00 +01:00
return false;
2010-01-02 22:00:00 +01:00
if( curpos.y < real_rect.top + WND_HEADSIZE + WND_BORDER )
2010-01-01 22:00:00 +01:00
return false;
2010-01-02 22:00:00 +01:00
if( curpos.y > real_rect.bottom - WND_BORDER * 3 )
2010-01-01 22:00:00 +01:00
return false;
return true;
}
2011-04-01 22:00:00 +02:00
static void IN_ActivateCursor( void )
{
if( cls.key_dest == key_menu )
{
SetCursor( in_mousecursor );
}
}
void IN_SetCursor( HICON hCursor )
{
in_mousecursor = hCursor;
IN_ActivateCursor();
}
2018-03-20 22:00:00 +01:00
/*
===========
IN_MouseSavePos
Save mouse pos before state change e.g. changelevel
===========
*/
void IN_MouseSavePos( void )
{
if( !in_mouseactive )
return;
GetCursorPos( &in_lastvalidpos );
in_mouse_savedpos = true;
}
/*
===========
IN_MouseRestorePos
Restore right position for background
===========
*/
void IN_MouseRestorePos( void )
{
if( !in_mouse_savedpos )
return;
SetCursorPos( in_lastvalidpos.x, in_lastvalidpos.y );
in_mouse_savedpos = false;
}
2010-11-15 22:00:00 +01:00
/*
===========
IN_ToggleClientMouse
Called when key_dest is changed
===========
*/
void IN_ToggleClientMouse( int newstate, int oldstate )
{
if( newstate == oldstate ) return;
if( oldstate == key_game )
{
clgame.dllFuncs.IN_DeactivateMouse();
}
else if( newstate == key_game )
{
2012-04-25 22:00:00 +02:00
// reset mouse pos, so cancel effect in game
SetCursorPos( host.window_center_x, host.window_center_y );
2010-11-15 22:00:00 +01:00
clgame.dllFuncs.IN_ActivateMouse();
}
2011-04-01 22:00:00 +02:00
2017-02-13 22:00:00 +01:00
if( newstate == key_menu && ( !CL_IsBackgroundMap() || CL_IsBackgroundDemo( )))
2011-04-01 22:00:00 +02:00
{
in_mouseactive = false;
ClipCursor( NULL );
ReleaseCapture();
while( ShowCursor( true ) < 0 );
}
2010-11-15 22:00:00 +01:00
}
2010-01-01 22:00:00 +01:00
2018-06-13 23:00:00 +02:00
/*
===========
IN_RecalcCenter
Recalc the center of screen
===========
*/
2018-06-15 23:00:00 +02:00
void IN_RecalcCenter( qboolean setpos )
2018-06-13 23:00:00 +02:00
{
2018-06-15 23:00:00 +02:00
int width, height;
2018-06-13 23:00:00 +02:00
2018-06-15 23:00:00 +02:00
if( host.status != HOST_FRAME )
return;
width = GetSystemMetrics( SM_CXSCREEN );
height = GetSystemMetrics( SM_CYSCREEN );
2018-06-13 23:00:00 +02:00
GetWindowRect( host.hWnd, &window_rect );
if( window_rect.left < 0 ) window_rect.left = 0;
if( window_rect.top < 0 ) window_rect.top = 0;
if( window_rect.right >= width ) window_rect.right = width - 1;
if( window_rect.bottom >= height - 1 ) window_rect.bottom = height - 1;
host.window_center_x = (window_rect.right + window_rect.left) / 2;
host.window_center_y = (window_rect.top + window_rect.bottom) / 2;
2018-06-15 23:00:00 +02:00
if( setpos ) SetCursorPos( host.window_center_x, host.window_center_y );
2018-06-13 23:00:00 +02:00
}
2008-07-06 22:00:00 +02:00
/*
===========
IN_ActivateMouse
Called when the window gains focus or changes in some way
===========
*/
2011-03-20 22:00:00 +01:00
void IN_ActivateMouse( qboolean force )
2008-07-06 22:00:00 +02:00
{
2010-01-01 22:00:00 +01:00
static int oldstate;
2010-01-02 22:00:00 +01:00
2008-07-06 22:00:00 +02:00
if( !in_mouseinitialized )
return;
2011-03-20 22:00:00 +01:00
if( CL_Active() && host.mouse_visible && !force )
2011-03-19 22:00:00 +01:00
return; // VGUI controls
2010-12-27 22:00:00 +01:00
if( cls.key_dest == key_menu && !Cvar_VariableInteger( "fullscreen" ))
2010-01-01 22:00:00 +01:00
{
// check for mouse leave-entering
2010-06-17 22:00:00 +02:00
if( !in_mouse_suspended && !UI_MouseInRect( ))
2010-01-01 22:00:00 +01:00
in_mouse_suspended = true;
if( oldstate != in_mouse_suspended )
{
if( in_mouse_suspended )
{
ClipCursor( NULL );
ReleaseCapture();
while( ShowCursor( true ) < 0 );
2010-01-02 22:00:00 +01:00
UI_ShowCursor( false );
2010-01-01 22:00:00 +01:00
}
}
oldstate = in_mouse_suspended;
2010-06-17 22:00:00 +02:00
if( in_mouse_suspended && IN_CursorInRect( ))
2010-01-01 22:00:00 +01:00
{
in_mouse_suspended = false;
in_mouseactive = false; // re-initialize mouse
2010-01-02 22:00:00 +01:00
UI_ShowCursor( true );
2010-01-01 22:00:00 +01:00
}
}
2008-07-06 22:00:00 +02:00
if( in_mouseactive ) return;
in_mouseactive = true;
2011-04-01 22:00:00 +02:00
if( UI_IsVisible( )) return;
2011-02-15 22:00:00 +01:00
if( cls.key_dest == key_game )
2010-11-15 22:00:00 +01:00
{
clgame.dllFuncs.IN_ActivateMouse();
}
2008-07-06 22:00:00 +02:00
2018-06-15 23:00:00 +02:00
IN_RecalcCenter( true );
2008-07-06 22:00:00 +02:00
SetCapture( host.hWnd );
2009-10-02 22:00:00 +02:00
ClipCursor( &window_rect );
2011-03-19 22:00:00 +01:00
while( ShowCursor( false ) >= 0 );
2008-07-06 22:00:00 +02:00
}
/*
===========
IN_DeactivateMouse
Called when the window loses focus
===========
*/
void IN_DeactivateMouse( void )
{
if( !in_mouseinitialized || !in_mouseactive )
return;
2011-02-15 22:00:00 +01:00
if( cls.key_dest == key_game )
2010-11-15 22:00:00 +01:00
{
clgame.dllFuncs.IN_DeactivateMouse();
}
2008-07-06 22:00:00 +02:00
in_mouseactive = false;
ClipCursor( NULL );
ReleaseCapture();
2010-06-17 22:00:00 +02:00
while( ShowCursor( true ) < 0 );
2008-07-06 22:00:00 +02:00
}
/*
================
2016-11-19 22:00:00 +01:00
IN_MouseMove
2008-07-06 22:00:00 +02:00
================
*/
void IN_MouseMove( void )
{
POINT current_pos;
2011-04-01 22:00:00 +02:00
if( !in_mouseinitialized || !in_mouseactive || !UI_IsVisible( ))
2008-07-06 22:00:00 +02:00
return;
// find mouse movement
GetCursorPos( &current_pos );
2011-04-01 22:00:00 +02:00
ScreenToClient( host.hWnd, &current_pos );
2011-03-28 22:00:00 +02:00
// if the menu is visible, move the menu cursor
2011-04-01 22:00:00 +02:00
UI_MouseMove( current_pos.x, current_pos.y );
IN_ActivateCursor();
2008-07-06 22:00:00 +02:00
}
/*
===========
IN_MouseEvent
===========
*/
void IN_MouseEvent( int mstate )
{
int i;
2008-08-10 22:00:00 +02:00
if( !in_mouseinitialized || !in_mouseactive )
2008-07-06 22:00:00 +02:00
return;
2011-02-15 22:00:00 +01:00
if( cls.key_dest == key_game )
2010-11-15 22:00:00 +01:00
{
clgame.dllFuncs.IN_MouseEvent( mstate );
return;
}
2008-07-06 22:00:00 +02:00
// perform button actions
for( i = 0; i < in_mouse_buttons; i++ )
{
2016-11-19 22:00:00 +01:00
if( FBitSet( mstate, BIT( i )) && !FBitSet( in_mouse_oldbuttonstate, BIT( i )))
2008-07-06 22:00:00 +02:00
{
2011-03-28 22:00:00 +02:00
Key_Event( K_MOUSE1 + i, true );
2008-07-06 22:00:00 +02:00
}
2012-12-21 21:00:00 +01:00
2016-11-19 22:00:00 +01:00
if( !FBitSet( mstate, BIT( i )) && FBitSet( in_mouse_oldbuttonstate, BIT( i )))
2008-07-06 22:00:00 +02:00
{
2011-03-28 22:00:00 +02:00
Key_Event( K_MOUSE1 + i, false );
2008-07-06 22:00:00 +02:00
}
}
2010-10-09 22:00:00 +02:00
2008-07-06 22:00:00 +02:00
in_mouse_oldbuttonstate = mstate;
}
/*
===========
IN_Shutdown
===========
*/
void IN_Shutdown( void )
{
2010-06-17 22:00:00 +02:00
IN_DeactivateMouse( );
2008-07-06 22:00:00 +02:00
}
/*
===========
IN_Init
===========
*/
void IN_Init( void )
{
2010-06-17 22:00:00 +02:00
IN_StartupMouse( );
2008-07-06 22:00:00 +02:00
}
/*
==================
2010-10-09 22:00:00 +02:00
Host_InputFrame
2008-07-06 22:00:00 +02:00
Called every frame, even if not generating commands
==================
*/
2010-10-09 22:00:00 +02:00
void Host_InputFrame( void )
2008-07-06 22:00:00 +02:00
{
2010-10-26 22:00:00 +02:00
qboolean shutdownMouse = false;
2009-09-11 22:00:00 +02:00
2011-03-28 22:00:00 +02:00
Sys_SendKeyEvents ();
2008-07-06 22:00:00 +02:00
if( !in_mouseinitialized )
return;
2010-10-09 22:00:00 +02:00
2018-02-25 22:00:00 +01:00
if( host.status != HOST_FRAME )
2008-07-06 22:00:00 +02:00
{
IN_DeactivateMouse();
return;
}
2017-02-13 22:00:00 +01:00
// release mouse during pause or console typeing
2017-02-15 22:00:00 +01:00
if( cl.paused && cls.key_dest == key_game )
2017-02-13 22:00:00 +01:00
shutdownMouse = true;
2009-09-11 22:00:00 +02:00
if( shutdownMouse && !Cvar_VariableInteger( "fullscreen" ))
2008-07-06 22:00:00 +02:00
{
2009-09-11 22:00:00 +02:00
IN_DeactivateMouse();
return;
2008-07-06 22:00:00 +02:00
}
2011-03-20 22:00:00 +01:00
IN_ActivateMouse( false );
2008-07-06 22:00:00 +02:00
IN_MouseMove();
2008-08-04 22:00:00 +02:00
}
/*
====================
IN_WndProc
main window procedure
====================
*/
2016-08-13 23:00:00 +02:00
LONG IN_WndProc( HWND hWnd, UINT uMsg, UINT wParam, LONG lParam )
2008-08-04 22:00:00 +02:00
{
2010-09-16 22:00:00 +02:00
int i, temp = 0;
2010-12-21 22:00:00 +01:00
qboolean fActivate;
2008-08-04 22:00:00 +02:00
2009-02-02 22:00:00 +01:00
if( uMsg == in_mouse_wheel )
uMsg = WM_MOUSEWHEEL;
2011-03-19 22:00:00 +01:00
VGUI_SurfaceWndProc( hWnd, uMsg, wParam, lParam );
2008-08-04 22:00:00 +02:00
switch( uMsg )
{
2009-02-02 22:00:00 +01:00
case WM_KILLFOCUS:
2010-12-27 22:00:00 +01:00
if( Cvar_VariableInteger( "fullscreen" ))
2009-02-02 22:00:00 +01:00
ShowWindow( host.hWnd, SW_SHOWMINNOACTIVE );
break;
2011-04-01 22:00:00 +02:00
case WM_SETCURSOR:
IN_ActivateCursor();
break;
2008-08-04 22:00:00 +02:00
case WM_MOUSEWHEEL:
2016-11-19 22:00:00 +01:00
if( !in_mouseactive )
break;
2010-06-17 22:00:00 +02:00
if(( short )HIWORD( wParam ) > 0 )
2008-08-04 22:00:00 +02:00
{
2011-03-28 22:00:00 +02:00
Key_Event( K_MWHEELUP, true );
Key_Event( K_MWHEELUP, false );
2008-08-04 22:00:00 +02:00
}
else
{
2011-03-28 22:00:00 +02:00
Key_Event( K_MWHEELDOWN, true );
Key_Event( K_MWHEELDOWN, false );
2008-08-04 22:00:00 +02:00
}
break;
case WM_CREATE:
host.hWnd = hWnd;
2010-01-02 22:00:00 +01:00
GetWindowRect( host.hWnd, &real_rect );
2012-01-27 21:00:00 +01:00
RegisterHotKey( host.hWnd, PRINTSCREEN_ID, 0, VK_SNAPSHOT );
2008-08-04 22:00:00 +02:00
break;
case WM_CLOSE:
2011-04-06 22:00:00 +02:00
Sys_Quit();
2008-08-04 22:00:00 +02:00
break;
case WM_ACTIVATE:
2018-02-25 22:00:00 +01:00
if( host.status == HOST_SHUTDOWN )
2011-03-09 22:00:00 +01:00
break; // no need to activate
2016-11-19 22:00:00 +01:00
if( HIWORD( wParam ))
2018-02-25 22:00:00 +01:00
host.status = HOST_SLEEP;
2016-11-19 22:00:00 +01:00
else if( LOWORD( wParam ) == WA_INACTIVE )
2018-02-25 22:00:00 +01:00
host.status = HOST_NOFOCUS;
else host.status = HOST_FRAME;
fActivate = (host.status == HOST_FRAME) ? true : false;
2010-10-06 22:00:00 +02:00
wnd_caption = GetSystemMetrics( SM_CYCAPTION ) + WND_BORDER;
2008-08-04 22:00:00 +02:00
2011-02-20 22:00:00 +01:00
S_Activate( fActivate, host.hWnd );
2011-03-20 22:00:00 +01:00
IN_ActivateMouse( fActivate );
2011-02-20 22:00:00 +01:00
Key_ClearStates();
2018-06-15 23:00:00 +02:00
IN_RecalcCenter( false );
2011-01-31 22:00:00 +01:00
2018-02-25 22:00:00 +01:00
if( host.status == HOST_FRAME )
2008-08-04 22:00:00 +02:00
{
SetForegroundWindow( hWnd );
ShowWindow( hWnd, SW_RESTORE );
}
2016-11-19 22:00:00 +01:00
else if( Cvar_VariableInteger( "fullscreen" ))
2008-08-04 22:00:00 +02:00
{
ShowWindow( hWnd, SW_MINIMIZE );
}
break;
case WM_MOVE:
2010-12-27 22:00:00 +01:00
if( !Cvar_VariableInteger( "fullscreen" ))
2008-08-04 22:00:00 +02:00
{
2010-06-17 22:00:00 +02:00
RECT rect;
int xPos, yPos, style;
2008-08-04 22:00:00 +02:00
2009-10-02 22:00:00 +02:00
xPos = (short)LOWORD( lParam ); // horizontal position
yPos = (short)HIWORD( lParam ); // vertical position
2008-08-04 22:00:00 +02:00
2010-06-17 22:00:00 +02:00
rect.left = rect.top = 0;
rect.right = rect.bottom = 1;
2008-08-04 22:00:00 +02:00
style = GetWindowLong( hWnd, GWL_STYLE );
2010-06-17 22:00:00 +02:00
AdjustWindowRect( &rect, style, FALSE );
2008-08-04 22:00:00 +02:00
2017-03-21 22:00:00 +01:00
Cvar_SetValue( "_window_xpos", xPos + rect.left );
Cvar_SetValue( "_window_ypos", yPos + rect.top );
2010-01-02 22:00:00 +01:00
GetWindowRect( host.hWnd, &real_rect );
2008-08-04 22:00:00 +02:00
}
break;
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
case WM_RBUTTONDOWN:
case WM_RBUTTONUP:
case WM_MBUTTONDOWN:
case WM_MBUTTONUP:
2010-09-16 22:00:00 +02:00
case WM_XBUTTONDOWN:
case WM_XBUTTONUP:
2008-08-04 22:00:00 +02:00
case WM_MOUSEMOVE:
2010-09-16 22:00:00 +02:00
for( i = 0; i < in_mouse_buttons; i++ )
{
if( wParam & mouse_buttons[i] )
temp |= (1<<i);
}
2008-08-04 22:00:00 +02:00
IN_MouseEvent( temp );
break;
case WM_SYSCOMMAND:
2018-11-02 22:00:00 +01:00
// never turn screensaver or display off while Xash is active
if(( wParam == SC_SCREENSAVE || wParam == SC_MONITORPOWER ) && host.status != HOST_SLEEP )
2010-02-18 22:00:00 +01:00
return 0;
2008-08-04 22:00:00 +02:00
break;
case WM_SYSKEYDOWN:
if( wParam == VK_RETURN )
{
// alt+enter fullscreen switch
2017-02-12 22:00:00 +01:00
Cvar_SetValue( "fullscreen", !Cvar_VariableValue( "fullscreen" ));
2008-08-04 22:00:00 +02:00
return 0;
}
// intentional fallthrough
case WM_KEYDOWN:
2011-03-28 22:00:00 +02:00
Key_Event( Host_MapKey( lParam ), true );
2012-06-25 22:00:00 +02:00
if( Host_MapKey( lParam ) == K_ALT )
return 0; // prevent WC_SYSMENU call
2008-08-04 22:00:00 +02:00
break;
case WM_SYSKEYUP:
case WM_KEYUP:
2011-03-28 22:00:00 +02:00
Key_Event( Host_MapKey( lParam ), false );
2008-08-04 22:00:00 +02:00
break;
case WM_CHAR:
2011-03-28 22:00:00 +02:00
CL_CharEvent( wParam );
2008-08-04 22:00:00 +02:00
break;
2012-01-27 21:00:00 +01:00
case WM_HOTKEY:
switch( LOWORD( wParam ))
{
case PRINTSCREEN_ID:
// anti FiEctro system: prevent to write snapshot without Xash version
Q_strncpy( cls.shotname, "clipboard.bmp", sizeof( cls.shotname ));
cls.scrshot_action = scrshot_snapshot; // build new frame for screenshot
host.write_to_clipboard = true;
cls.envshot_vieworg = NULL;
break;
}
break;
2008-08-04 22:00:00 +02:00
}
2012-12-21 21:00:00 +01:00
2008-08-04 22:00:00 +02:00
return DefWindowProc( hWnd, uMsg, wParam, lParam );
2008-07-06 22:00:00 +02:00
}