- Enable menu mouse navigation on SDL systems.

SVN r3112 (trunk)
This commit is contained in:
Braden Obrzut 2011-01-22 03:02:58 +00:00
parent 622d1ebe6a
commit 7ed7e9f755
3 changed files with 51 additions and 41 deletions

View file

@ -507,11 +507,7 @@ bool M_Responder (event_t *ev)
// do we want mouse input?
if (ev->subtype >= EV_GUI_FirstMouseEvent && ev->subtype <= EV_GUI_LastMouseEvent)
{
// FIXME: Mouse events in SDL code are mostly useless so mouse is
// disabled until that code is fixed
#ifdef _WIN32
if (!m_use_mouse)
#endif
return true;
}

View file

@ -299,7 +299,10 @@ void MessagePump (const SDL_Event &sev)
case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP:
case SDL_MOUSEMOTION:
if (!GUICapture || sev.button.button == 4 || sev.button.button == 5)
{
if(sev.type != SDL_MOUSEMOTION)
{
event.type = sev.type == SDL_MOUSEBUTTONDOWN ? EV_KeyDown : EV_KeyUp;
/* These button mappings work with my Gentoo system using the
@ -338,11 +341,22 @@ void MessagePump (const SDL_Event &sev)
}
}
}
else if (sev.button.button >= 1 && sev.button.button <= 3)
}
else if (sev.type == SDL_MOUSEMOTION || (sev.button.button >= 1 && sev.button.button <= 3))
{
int x, y;
SDL_GetMouseState (&x, &y);
event.data1 = x;
event.data2 = y;
event.type = EV_GUI_Event;
if(sev.type == SDL_MOUSEMOTION)
event.subtype = EV_GUI_MouseMove;
else
{
event.subtype = sev.type == SDL_MOUSEBUTTONDOWN ? EV_GUI_LButtonDown : EV_GUI_LButtonUp;
event.subtype += (sev.button.button - 1) * 3;
}
D_PostEvent(&event);
}
break;

View file

@ -526,10 +526,10 @@ OptionMenu "MouseOptions"
{
Title "MOUSE OPTIONS"
Option "Enable mouse", "use_mouse", "YesNo"
IfOption(Windows) // GUI mouse not operable in SDL interface right now.
{
Option "Enable mouse in menus", "m_use_mouse", "MenuMouse", "use_mouse"
Option "Show back button", "m_show_backbutton", "Corners", "use_mouse"
IfOption(Windows) // No cursors on SDL right now.
{
Option "Cursor", "vid_cursor", "Cursors"
}
StaticText ""