mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-01-18 23:21:41 +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?
|
// do we want mouse input?
|
||||||
if (ev->subtype >= EV_GUI_FirstMouseEvent && ev->subtype <= EV_GUI_LastMouseEvent)
|
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)
|
if (!m_use_mouse)
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -299,50 +299,64 @@ void MessagePump (const SDL_Event &sev)
|
||||||
|
|
||||||
case SDL_MOUSEBUTTONDOWN:
|
case SDL_MOUSEBUTTONDOWN:
|
||||||
case SDL_MOUSEBUTTONUP:
|
case SDL_MOUSEBUTTONUP:
|
||||||
|
case SDL_MOUSEMOTION:
|
||||||
if (!GUICapture || sev.button.button == 4 || sev.button.button == 5)
|
if (!GUICapture || sev.button.button == 4 || sev.button.button == 5)
|
||||||
{
|
{
|
||||||
event.type = sev.type == SDL_MOUSEBUTTONDOWN ? EV_KeyDown : EV_KeyUp;
|
if(sev.type != SDL_MOUSEMOTION)
|
||||||
/* 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)
|
|
||||||
{
|
{
|
||||||
case 1: event.data1 = KEY_MOUSE1; break;
|
event.type = sev.type == SDL_MOUSEBUTTONDOWN ? EV_KeyDown : EV_KeyUp;
|
||||||
case 2: event.data1 = KEY_MOUSE3; break;
|
/* These button mappings work with my Gentoo system using the
|
||||||
case 3: event.data1 = KEY_MOUSE2; break;
|
* evdev driver and a Logitech MX510 mouse. Whether or not they
|
||||||
case 4: event.data1 = KEY_MWHEELUP; break;
|
* carry over to other Linux systems, I have no idea, but I sure
|
||||||
case 5: event.data1 = KEY_MWHEELDOWN; break;
|
* hope so. (Though buttons 11 and 12 are kind of useless, since
|
||||||
case 6: event.data1 = KEY_MOUSE4; break; /* dunno; not generated by my mouse */
|
* they also trigger buttons 4 and 5.)
|
||||||
case 7: event.data1 = KEY_MOUSE5; break; /* ditto */
|
*/
|
||||||
case 8: event.data1 = KEY_MOUSE4; break;
|
switch (sev.button.button)
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
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.type = EV_GUI_Event;
|
||||||
event.subtype = sev.type == SDL_MOUSEBUTTONDOWN ? EV_GUI_LButtonDown : EV_GUI_LButtonUp;
|
if(sev.type == SDL_MOUSEMOTION)
|
||||||
event.subtype += (sev.button.button - 1) * 3;
|
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);
|
D_PostEvent(&event);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -526,10 +526,10 @@ OptionMenu "MouseOptions"
|
||||||
{
|
{
|
||||||
Title "MOUSE OPTIONS"
|
Title "MOUSE OPTIONS"
|
||||||
Option "Enable mouse", "use_mouse", "YesNo"
|
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"
|
Option "Cursor", "vid_cursor", "Cursors"
|
||||||
}
|
}
|
||||||
StaticText ""
|
StaticText ""
|
||||||
|
|
Loading…
Reference in a new issue