This commit is contained in:
Branimir Karadžić 2014-10-12 11:51:58 -07:00
parent 42c9dafd03
commit cd2d643522

View file

@ -268,8 +268,11 @@ namespace entry
{
const SDL_MouseMotionEvent& mev = event.motion;
WindowHandle handle = findHandle(mev.windowID);
if (isValid(handle) )
{
m_eventQueue.postMouseEvent(handle, mev.x, mev.y, 0);
}
}
break;
case SDL_MOUSEBUTTONDOWN:
@ -277,8 +280,11 @@ namespace entry
{
const SDL_MouseButtonEvent& mev = event.button;
WindowHandle handle = findHandle(mev.windowID);
if (isValid(handle) )
{
m_eventQueue.postMouseEvent(handle, mev.x, mev.y, 0, MouseButton::Left, mev.type == SDL_MOUSEBUTTONDOWN);
}
}
break;
case SDL_KEYDOWN:
@ -286,10 +292,13 @@ namespace entry
{
const SDL_KeyboardEvent& kev = event.key;
WindowHandle handle = findHandle(kev.windowID);
if (isValid(handle) )
{
uint8_t modifiers = translateKeyModifiers(kev.keysym.mod);
Key::Enum key = translateKey(kev.keysym.scancode);
m_eventQueue.postKeyEvent(handle, key, modifiers, kev.state == SDL_PRESSED);
}
}
break;
case SDL_WINDOWEVENT:
@ -367,17 +376,23 @@ namespace entry
case SDL_USER_WINDOW_DESTROY:
{
WindowHandle handle = getWindowHandle(uev);
if (isValid(handle) )
{
m_eventQueue.postWindowEvent(handle);
SDL_DestroyWindow(m_window[handle.idx]);
m_window[handle.idx] = NULL;
}
}
break;
case SDL_USER_WINDOW_SET_TITLE:
{
WindowHandle handle = getWindowHandle(uev);
Msg* msg = (Msg*)uev.data2;
if (isValid(handle) )
{
SDL_SetWindowTitle(m_window[handle.idx], msg->m_title.c_str());
}
delete msg;
}
break;
@ -395,16 +410,23 @@ namespace entry
{
WindowHandle handle = getWindowHandle(uev);
Msg* msg = (Msg*)uev.data2;
if (isValid(handle) )
{
setWindowSize(handle, msg->m_width, msg->m_height);
}
delete msg;
}
break;
case SDL_USER_WINDOW_TOGGLE_FRAME:
{
WindowHandle handle = getWindowHandle(uev);
if (isValid(handle) )
{
m_flags[handle.idx] ^= ENTRY_WINDOW_FLAG_FRAME;
SDL_SetWindowBordered(m_window[handle.idx], (SDL_bool)!!(m_flags[handle.idx] & ENTRY_WINDOW_FLAG_FRAME) );
}
}
break;
case SDL_USER_WINDOW_MOUSE_LOCK: