mirror of
https://github.com/AxioDL/boo.git
synced 2025-06-06 22:53:39 +00:00
[Win32] Proper handling of character case for keyboard events
This commit is contained in:
parent
511ac1fad7
commit
886ae22e08
@ -96,6 +96,7 @@ public:
|
|||||||
WIN32_CURSORS.m_arrow = LoadCursor(nullptr, IDC_ARROW);
|
WIN32_CURSORS.m_arrow = LoadCursor(nullptr, IDC_ARROW);
|
||||||
WIN32_CURSORS.m_hResize = LoadCursor(nullptr, IDC_SIZEWE);
|
WIN32_CURSORS.m_hResize = LoadCursor(nullptr, IDC_SIZEWE);
|
||||||
WIN32_CURSORS.m_vResize = LoadCursor(nullptr, IDC_SIZENS);
|
WIN32_CURSORS.m_vResize = LoadCursor(nullptr, IDC_SIZENS);
|
||||||
|
WIN32_CURSORS.m_ibeam = LoadCursor(nullptr, IDC_IBEAM);
|
||||||
WIN32_CURSORS.m_wait = LoadCursor(nullptr, IDC_WAIT);
|
WIN32_CURSORS.m_wait = LoadCursor(nullptr, IDC_WAIT);
|
||||||
|
|
||||||
HMODULE dxgilib = LoadLibraryW(L"dxgi.dll");
|
HMODULE dxgilib = LoadLibraryW(L"dxgi.dll");
|
||||||
|
@ -260,6 +260,7 @@ struct Win32Cursors
|
|||||||
HCURSOR m_arrow;
|
HCURSOR m_arrow;
|
||||||
HCURSOR m_hResize;
|
HCURSOR m_hResize;
|
||||||
HCURSOR m_vResize;
|
HCURSOR m_vResize;
|
||||||
|
HCURSOR m_ibeam;
|
||||||
HCURSOR m_wait;
|
HCURSOR m_wait;
|
||||||
};
|
};
|
||||||
namespace boo
|
namespace boo
|
||||||
|
@ -410,23 +410,31 @@ static uint32_t translateKeysym(WPARAM sym, ESpecialKey& specialSym, EModifierKe
|
|||||||
specialSym = ESpecialKey::Up;
|
specialSym = ESpecialKey::Up;
|
||||||
else if (sym == VK_DOWN)
|
else if (sym == VK_DOWN)
|
||||||
specialSym = ESpecialKey::Down;
|
specialSym = ESpecialKey::Down;
|
||||||
else if (sym == VK_LSHIFT || sym == VK_RSHIFT)
|
else if (sym == VK_SHIFT)
|
||||||
modifierSym = EModifierKey::Shift;
|
modifierSym = EModifierKey::Shift;
|
||||||
else if (sym == VK_LCONTROL || sym == VK_RCONTROL)
|
else if (sym == VK_CONTROL)
|
||||||
modifierSym = EModifierKey::Ctrl;
|
modifierSym = EModifierKey::Ctrl;
|
||||||
else if (sym == VK_MENU)
|
else if (sym == VK_MENU)
|
||||||
modifierSym = EModifierKey::Alt;
|
modifierSym = EModifierKey::Alt;
|
||||||
else
|
else
|
||||||
return MapVirtualKey(sym, MAPVK_VK_TO_CHAR);
|
{
|
||||||
|
UINT vk = MapVirtualKey(sym, MAPVK_VK_TO_CHAR);
|
||||||
|
if (__isascii(vk))
|
||||||
|
{
|
||||||
|
if (!(((GetKeyState(VK_SHIFT) & 0x8000) != 0) ^ (GetKeyState(VK_CAPITAL) != 0)))
|
||||||
|
vk = tolower(vk);
|
||||||
|
}
|
||||||
|
return vk;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static EModifierKey translateModifiers(UINT msg)
|
static EModifierKey translateModifiers(UINT msg)
|
||||||
{
|
{
|
||||||
EModifierKey retval = EModifierKey::None;
|
EModifierKey retval = EModifierKey::None;
|
||||||
if ((GetKeyState(VK_LSHIFT) & 0x8000) != 0 || (GetKeyState(VK_RSHIFT) & 0x8000) != 0)
|
if ((GetKeyState(VK_SHIFT) & 0x8000) != 0)
|
||||||
retval |= EModifierKey::Shift;
|
retval |= EModifierKey::Shift;
|
||||||
if ((GetKeyState(VK_LCONTROL) & 0x8000) != 0 || (GetKeyState(VK_RCONTROL) & 0x8000) != 0)
|
if ((GetKeyState(VK_CONTROL) & 0x8000) != 0)
|
||||||
retval |= EModifierKey::Ctrl;
|
retval |= EModifierKey::Ctrl;
|
||||||
if ((GetKeyState(VK_MENU) & 0x8000) != 0)
|
if ((GetKeyState(VK_MENU) & 0x8000) != 0)
|
||||||
retval |= EModifierKey::Alt;
|
retval |= EModifierKey::Alt;
|
||||||
@ -453,6 +461,8 @@ class WindowWin32 : public IWindow
|
|||||||
return WIN32_CURSORS.m_hResize;
|
return WIN32_CURSORS.m_hResize;
|
||||||
case EMouseCursor::VerticalArrow:
|
case EMouseCursor::VerticalArrow:
|
||||||
return WIN32_CURSORS.m_vResize;
|
return WIN32_CURSORS.m_vResize;
|
||||||
|
case EMouseCursor::IBeam:
|
||||||
|
return WIN32_CURSORS.m_ibeam;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
return WIN32_CURSORS.m_arrow;
|
return WIN32_CURSORS.m_arrow;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user