diff --git a/Quake/in_sdl.c b/Quake/in_sdl.c index 9f28569f2..30a245dd3 100644 --- a/Quake/in_sdl.c +++ b/Quake/in_sdl.c @@ -223,6 +223,8 @@ void IN_Deactivate (qboolean free_cursor) if (free_cursor) IN_ShowCursor(); + else + IN_HideCursor(); /* discard all mouse events when input is deactivated */ IN_BeginIgnoringMouseEvents(); diff --git a/Quake/menu.c b/Quake/menu.c index 58df2ae8c..d7979a086 100644 --- a/Quake/menu.c +++ b/Quake/menu.c @@ -57,6 +57,7 @@ extern qboolean quake64; enum m_state_e m_state; extern qboolean keydown[256]; int m_mousex, m_mousey; +qboolean m_ignoremouseframe; static int m_left, m_top, m_width, m_height; static void M_UpdateBounds (void); @@ -5849,6 +5850,31 @@ void M_Menu_Credits_f (void) //============================================================================= /* Menu Subsystem */ +static void UI_Mouse_f (cvar_t *cvar) +{ + // Ignore first mouse move message after we re-enable the option. + // This makes it possible to cycle through the UI Mouse options + // in full-screen mode using the keyboard without having the + // selected item change due to the automatic mouse move message + // sent when the cursor is shown again. + m_ignoremouseframe = true; + + switch (key_dest) + { + case key_menu: + IN_DeactivateForMenu (); + break; + case key_console: + IN_DeactivateForConsole (); + break; + case key_game: + case key_message: + IN_Activate (); + break; + default: + break; + } +} void M_Init (void) { @@ -5870,6 +5896,7 @@ void M_Init (void) Cmd_AddCommand ("menu_maps", M_Menu_Maps_f); Cvar_RegisterVariable (&ui_mouse); + Cvar_SetCallback (&ui_mouse, UI_Mouse_f); Cvar_RegisterVariable (&ui_mouse_sound); Cvar_RegisterVariable (&ui_sound_throttle); Cvar_RegisterVariable (&ui_search_timeout); @@ -6129,6 +6156,12 @@ void M_Mousemove (int x, int y) m_mousex = x = (int) (px + 0.5f); m_mousey = y = (int) (py + 0.5f); + if (m_ignoremouseframe) + { + m_ignoremouseframe = false; + return; + } + switch (m_state) { default: