From 2be6d55f4aef1e7b92e116be3460b4c47bcc22d6 Mon Sep 17 00:00:00 2001 From: Spoike Date: Fri, 10 Mar 2006 03:52:12 +0000 Subject: [PATCH] Fix for mouse pointers (should be more generic fixme: port changes to linux input too) git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2073 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/in_win.c | 6 +----- engine/client/keys.c | 31 ++++++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/engine/client/in_win.c b/engine/client/in_win.c index 6468339ad..5db55acf4 100644 --- a/engine/client/in_win.c +++ b/engine/client/in_win.c @@ -1383,11 +1383,7 @@ static void ProcessMouse(mouse_t *mouse, usercmd_t *cmd, int pnum) if(in_xflip.value) mx *= -1; #endif - if (mouseusedforgui || (key_dest == key_menu && (m_state == m_complex || m_state == m_plugin) || key_dest == key_console) -#ifdef VM_UI - || UI_MenuState() -#endif - ) + if (Key_MouseShouldBeFree()) { mousemove_x += mx; mousemove_y += my; diff --git a/engine/client/keys.c b/engine/client/keys.c index bd65eeb66..740aab41c 100644 --- a/engine/client/keys.c +++ b/engine/client/keys.c @@ -492,7 +492,7 @@ void Key_ConsoleRelease(int key) } for (x = con_mousedown[0]; x < xpos; x++) - *buf++ = con_current->text[x + ((y%con_current->totallines)*con_current->linewidth)]; + *buf++ = con_current->text[x + ((y%con_current->totallines)*con_current->linewidth)]&127; } while(buf > bufhead && buf[-1] == ' ') buf--; @@ -1274,6 +1274,35 @@ void Key_Init (void) Cvar_Register (&con_selectioncolour, "Console variables"); } +qboolean Key_MouseShouldBeFree(void) +{ + //returns if the mouse should be a cursor or if it should go to the menu + + //if true, the input code is expected to return mouse cursor positions rather than deltas + + extern int mouseusedforgui; + if (mouseusedforgui) //I don't like this + return true; + + if (key_dest == key_menu) + { + if (m_state == m_complex || m_state == m_plugin) + return true; + } + if (key_dest == key_console) + return true; + if (key_dest == key_game && cls.state < ca_connected) + return true; + +#ifdef VM_UI + if (UI_MenuState()) + return true; +#endif + + + return false; +} + /* =================== Key_Event