Added keyboard modifiers for mouse events in SDL backend.

This commit is contained in:
ZZYZX 2017-02-03 17:39:26 +02:00
parent b4565c3800
commit 08f1731ded

View file

@ -336,6 +336,12 @@ void MessagePump (const SDL_Event &sev)
event.subtype = sev.type == SDL_MOUSEBUTTONDOWN ? EV_GUI_LButtonDown : EV_GUI_LButtonUp; event.subtype = sev.type == SDL_MOUSEBUTTONDOWN ? EV_GUI_LButtonDown : EV_GUI_LButtonUp;
event.subtype += (sev.button.button - 1) * 3; event.subtype += (sev.button.button - 1) * 3;
} }
SDL_Keymod kmod = SDL_GetModState();
event.data3 = ((kmod & KMOD_SHIFT) ? GKM_SHIFT : 0) |
((kmod & KMOD_CTRL) ? GKM_CTRL : 0) |
((kmod & KMOD_ALT) ? GKM_ALT : 0);
D_PostEvent(&event); D_PostEvent(&event);
} }
break; break;
@ -345,6 +351,10 @@ void MessagePump (const SDL_Event &sev)
{ {
event.type = EV_GUI_Event; event.type = EV_GUI_Event;
event.subtype = sev.wheel.y > 0 ? EV_GUI_WheelUp : EV_GUI_WheelDown; event.subtype = sev.wheel.y > 0 ? EV_GUI_WheelUp : EV_GUI_WheelDown;
SDL_Keymod kmod = SDL_GetModState();
event.data3 = ((kmod & KMOD_SHIFT) ? GKM_SHIFT : 0) |
((kmod & KMOD_CTRL) ? GKM_CTRL : 0) |
((kmod & KMOD_ALT) ? GKM_ALT : 0);
D_PostEvent (&event); D_PostEvent (&event);
} }
else else