mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-01-18 15:11:46 +00:00
- Enable menu mouse navigation on SDL systems.
SVN r3112 (trunk)
This commit is contained in:
parent
622d1ebe6a
commit
7ed7e9f755
3 changed files with 51 additions and 41 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -299,54 +299,68 @@ 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)
|
||||
{
|
||||
event.type = sev.type == SDL_MOUSEBUTTONDOWN ? EV_KeyDown : EV_KeyUp;
|
||||
/* These button mappings work with my Gentoo system using the
|
||||
* evdev driver and a Logitech MX510 mouse. Whether or not they
|
||||
* carry over to other Linux systems, I have no idea, but I sure
|
||||
* hope so. (Though buttons 11 and 12 are kind of useless, since
|
||||
* they also trigger buttons 4 and 5.)
|
||||
*/
|
||||
switch (sev.button.button)
|
||||
if(sev.type != SDL_MOUSEMOTION)
|
||||
{
|
||||
case 1: event.data1 = KEY_MOUSE1; break;
|
||||
case 2: event.data1 = KEY_MOUSE3; break;
|
||||
case 3: event.data1 = KEY_MOUSE2; break;
|
||||
case 4: event.data1 = KEY_MWHEELUP; break;
|
||||
case 5: event.data1 = KEY_MWHEELDOWN; break;
|
||||
case 6: event.data1 = KEY_MOUSE4; break; /* dunno; not generated by my mouse */
|
||||
case 7: event.data1 = KEY_MOUSE5; break; /* ditto */
|
||||
case 8: event.data1 = KEY_MOUSE4; break;
|
||||
case 9: event.data1 = KEY_MOUSE5; break;
|
||||
case 10: event.data1 = KEY_MOUSE6; break;
|
||||
case 11: event.data1 = KEY_MOUSE7; break;
|
||||
case 12: event.data1 = KEY_MOUSE8; break;
|
||||
default: printf("SDL mouse button %s %d\n",
|
||||
sev.type == SDL_MOUSEBUTTONDOWN ? "down" : "up", sev.button.button); break;
|
||||
}
|
||||
if (event.data1 != 0)
|
||||
{
|
||||
//DIKState[ActiveDIKState][event.data1] = (event.type == EV_KeyDown);
|
||||
if (event.data1 == KEY_MWHEELUP || event.data1 == KEY_MWHEELDOWN)
|
||||
event.type = sev.type == SDL_MOUSEBUTTONDOWN ? EV_KeyDown : EV_KeyUp;
|
||||
/* These button mappings work with my Gentoo system using the
|
||||
* evdev driver and a Logitech MX510 mouse. Whether or not they
|
||||
* carry over to other Linux systems, I have no idea, but I sure
|
||||
* hope so. (Though buttons 11 and 12 are kind of useless, since
|
||||
* they also trigger buttons 4 and 5.)
|
||||
*/
|
||||
switch (sev.button.button)
|
||||
{
|
||||
WheelMoved(&event);
|
||||
case 1: event.data1 = KEY_MOUSE1; break;
|
||||
case 2: event.data1 = KEY_MOUSE3; break;
|
||||
case 3: event.data1 = KEY_MOUSE2; break;
|
||||
case 4: event.data1 = KEY_MWHEELUP; break;
|
||||
case 5: event.data1 = KEY_MWHEELDOWN; break;
|
||||
case 6: event.data1 = KEY_MOUSE4; break; /* dunno; not generated by my mouse */
|
||||
case 7: event.data1 = KEY_MOUSE5; break; /* ditto */
|
||||
case 8: event.data1 = KEY_MOUSE4; break;
|
||||
case 9: event.data1 = KEY_MOUSE5; break;
|
||||
case 10: event.data1 = KEY_MOUSE6; break;
|
||||
case 11: event.data1 = KEY_MOUSE7; break;
|
||||
case 12: event.data1 = KEY_MOUSE8; break;
|
||||
default: printf("SDL mouse button %s %d\n",
|
||||
sev.type == SDL_MOUSEBUTTONDOWN ? "down" : "up", sev.button.button); break;
|
||||
}
|
||||
else
|
||||
if (event.data1 != 0)
|
||||
{
|
||||
D_PostEvent(&event);
|
||||
//DIKState[ActiveDIKState][event.data1] = (event.type == EV_KeyDown);
|
||||
if (event.data1 == KEY_MWHEELUP || event.data1 == KEY_MWHEELDOWN)
|
||||
{
|
||||
WheelMoved(&event);
|
||||
}
|
||||
else
|
||||
{
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
event.subtype = sev.type == SDL_MOUSEBUTTONDOWN ? EV_GUI_LButtonDown : EV_GUI_LButtonUp;
|
||||
event.subtype += (sev.button.button - 1) * 3;
|
||||
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;
|
||||
|
||||
|
||||
case SDL_KEYDOWN:
|
||||
case SDL_KEYUP:
|
||||
if (sev.key.keysym.sym >= SDLK_LAST)
|
||||
|
|
|
@ -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 "Enable mouse in menus", "m_use_mouse", "MenuMouse", "use_mouse"
|
||||
Option "Show back button", "m_show_backbutton", "Corners", "use_mouse"
|
||||
Option "Cursor", "vid_cursor", "Cursors"
|
||||
}
|
||||
StaticText ""
|
||||
|
|
Loading…
Reference in a new issue