mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 12:08:47 +02:00
IO: Added "Super" keyboard modifiers (corresponding to Cmd on Mac and Windows key in theory although the later is hard to read) (#473)
NB: Value not used.
This commit is contained in:
@ -249,6 +249,7 @@ void ImGui_ImplA5_NewFrame()
|
||||
io.KeyCtrl = al_key_down(&keys, ALLEGRO_KEY_LCTRL) || al_key_down(&keys, ALLEGRO_KEY_RCTRL);
|
||||
io.KeyShift = al_key_down(&keys, ALLEGRO_KEY_LSHIFT) || al_key_down(&keys, ALLEGRO_KEY_RSHIFT);
|
||||
io.KeyAlt = al_key_down(&keys, ALLEGRO_KEY_ALT) || al_key_down(&keys, ALLEGRO_KEY_ALTGR);
|
||||
io.KeySuper = al_key_down(&keys, ALLEGRO_KEY_LWIN) || al_key_down(&keys, ALLEGRO_KEY_RWIN);
|
||||
|
||||
ALLEGRO_MOUSE_STATE mouse;
|
||||
if (keys.display == g_Display)
|
||||
|
@ -496,6 +496,7 @@ void ImGui_ImplDX10_NewFrame()
|
||||
io.KeyCtrl = (GetKeyState(VK_CONTROL) & 0x8000) != 0;
|
||||
io.KeyShift = (GetKeyState(VK_SHIFT) & 0x8000) != 0;
|
||||
io.KeyAlt = (GetKeyState(VK_MENU) & 0x8000) != 0;
|
||||
io.KeySuper = false;
|
||||
// io.KeysDown : filled by WM_KEYDOWN/WM_KEYUP events
|
||||
// io.MousePos : filled by WM_MOUSEMOVE events
|
||||
// io.MouseDown : filled by WM_*BUTTON* events
|
||||
|
@ -494,6 +494,7 @@ void ImGui_ImplDX11_NewFrame()
|
||||
io.KeyCtrl = (GetKeyState(VK_CONTROL) & 0x8000) != 0;
|
||||
io.KeyShift = (GetKeyState(VK_SHIFT) & 0x8000) != 0;
|
||||
io.KeyAlt = (GetKeyState(VK_MENU) & 0x8000) != 0;
|
||||
io.KeySuper = false;
|
||||
// io.KeysDown : filled by WM_KEYDOWN/WM_KEYUP events
|
||||
// io.MousePos : filled by WM_MOUSEMOVE events
|
||||
// io.MouseDown : filled by WM_*BUTTON* events
|
||||
|
@ -309,6 +309,7 @@ void ImGui_ImplDX9_NewFrame()
|
||||
io.KeyCtrl = (GetKeyState(VK_CONTROL) & 0x8000) != 0;
|
||||
io.KeyShift = (GetKeyState(VK_SHIFT) & 0x8000) != 0;
|
||||
io.KeyAlt = (GetKeyState(VK_MENU) & 0x8000) != 0;
|
||||
io.KeySuper = false;
|
||||
// io.KeysDown : filled by WM_KEYDOWN/WM_KEYUP events
|
||||
// io.MousePos : filled by WM_MOUSEMOVE events
|
||||
// io.MouseDown : filled by WM_*BUTTON* events
|
||||
|
@ -263,10 +263,10 @@ void ImGui_KeyboardCallback(uSynergyCookie cookie, uint16_t key,
|
||||
// printf("Synergy: keyboard callback: 0x%02X (%s)", scanCode, down?"true":"false");
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.KeysDown[key] = down;
|
||||
io.KeyShift = modifiers & USYNERGY_MODIFIER_SHIFT;
|
||||
io.KeyCtrl = modifiers & USYNERGY_MODIFIER_CTRL;
|
||||
io.KeyAlt = modifiers & USYNERGY_MODIFIER_ALT;
|
||||
|
||||
io.KeyShift = (modifiers & USYNERGY_MODIFIER_SHIFT);
|
||||
io.KeyCtrl = (modifiers & USYNERGY_MODIFIER_CTRL);
|
||||
io.KeyAlt = (modifiers & USYNERGY_MODIFIER_ALT);
|
||||
io.KeySuper = (modifiers & USYNERGY_MODIFIER_WIN);
|
||||
|
||||
// Add this as keyboard input
|
||||
if ((down) && (key) && (scanCode<256) && !(modifiers & USYNERGY_MODIFIER_CTRL))
|
||||
|
@ -153,6 +153,7 @@ int32 ImGui_Marmalade_KeyCallback(void* SystemData, void* userData)
|
||||
io.KeyCtrl = s3eKeyboardGetState(s3eKeyLeftControl) == S3E_KEY_STATE_DOWN || s3eKeyboardGetState(s3eKeyRightControl) == S3E_KEY_STATE_DOWN;
|
||||
io.KeyShift = s3eKeyboardGetState(s3eKeyLeftShift) == S3E_KEY_STATE_DOWN || s3eKeyboardGetState(s3eKeyRightShift) == S3E_KEY_STATE_DOWN;
|
||||
io.KeyAlt = s3eKeyboardGetState(s3eKeyLeftAlt) == S3E_KEY_STATE_DOWN || s3eKeyboardGetState(s3eKeyRightAlt) == S3E_KEY_STATE_DOWN;
|
||||
io.KeySuper = s3eKeyboardGetState(s3eKeyLeftWindows) == S3E_KEY_STATE_DOWN || s3eKeyboardGetState(s3eKeyRightWindows) == S3E_KEY_STATE_DOWN;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -157,6 +157,7 @@ void ImGui_ImplGlfwGL3_KeyCallback(GLFWwindow*, int key, int, int action, int mo
|
||||
io.KeyCtrl = io.KeysDown[GLFW_KEY_LEFT_CONTROL] || io.KeysDown[GLFW_KEY_RIGHT_CONTROL];
|
||||
io.KeyShift = io.KeysDown[GLFW_KEY_LEFT_SHIFT] || io.KeysDown[GLFW_KEY_RIGHT_SHIFT];
|
||||
io.KeyAlt = io.KeysDown[GLFW_KEY_LEFT_ALT] || io.KeysDown[GLFW_KEY_RIGHT_ALT];
|
||||
io.KeySuper = io.KeysDown[GLFW_KEY_LEFT_SUPER] || io.KeysDown[GLFW_KEY_RIGHT_SUPER];
|
||||
}
|
||||
|
||||
void ImGui_ImplGlfwGL3_CharCallback(GLFWwindow*, unsigned int c)
|
||||
|
@ -139,6 +139,7 @@ void ImGui_ImplGlFw_KeyCallback(GLFWwindow*, int key, int, int action, int mods)
|
||||
io.KeyCtrl = io.KeysDown[GLFW_KEY_LEFT_CONTROL] || io.KeysDown[GLFW_KEY_RIGHT_CONTROL];
|
||||
io.KeyShift = io.KeysDown[GLFW_KEY_LEFT_SHIFT] || io.KeysDown[GLFW_KEY_RIGHT_SHIFT];
|
||||
io.KeyAlt = io.KeysDown[GLFW_KEY_LEFT_ALT] || io.KeysDown[GLFW_KEY_RIGHT_ALT];
|
||||
io.KeySuper = io.KeysDown[GLFW_KEY_LEFT_SUPER] || io.KeysDown[GLFW_KEY_RIGHT_SUPER];
|
||||
}
|
||||
|
||||
void ImGui_ImplGlfw_CharCallback(GLFWwindow*, unsigned int c)
|
||||
|
@ -134,36 +134,37 @@ bool ImGui_ImplSdlGL3_ProcessEvent(SDL_Event* event)
|
||||
switch (event->type)
|
||||
{
|
||||
case SDL_MOUSEWHEEL:
|
||||
{
|
||||
if (event->wheel.y > 0)
|
||||
g_MouseWheel = 1;
|
||||
if (event->wheel.y < 0)
|
||||
g_MouseWheel = -1;
|
||||
return true;
|
||||
}
|
||||
{
|
||||
if (event->wheel.y > 0)
|
||||
g_MouseWheel = 1;
|
||||
if (event->wheel.y < 0)
|
||||
g_MouseWheel = -1;
|
||||
return true;
|
||||
}
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
{
|
||||
if (event->button.button == SDL_BUTTON_LEFT) g_MousePressed[0] = true;
|
||||
if (event->button.button == SDL_BUTTON_RIGHT) g_MousePressed[1] = true;
|
||||
if (event->button.button == SDL_BUTTON_MIDDLE) g_MousePressed[2] = true;
|
||||
return true;
|
||||
}
|
||||
{
|
||||
if (event->button.button == SDL_BUTTON_LEFT) g_MousePressed[0] = true;
|
||||
if (event->button.button == SDL_BUTTON_RIGHT) g_MousePressed[1] = true;
|
||||
if (event->button.button == SDL_BUTTON_MIDDLE) g_MousePressed[2] = true;
|
||||
return true;
|
||||
}
|
||||
case SDL_TEXTINPUT:
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.AddInputCharactersUTF8(event->text.text);
|
||||
return true;
|
||||
}
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.AddInputCharactersUTF8(event->text.text);
|
||||
return true;
|
||||
}
|
||||
case SDL_KEYDOWN:
|
||||
case SDL_KEYUP:
|
||||
{
|
||||
int key = event->key.keysym.sym & ~SDLK_SCANCODE_MASK;
|
||||
io.KeysDown[key] = (event->type == SDL_KEYDOWN);
|
||||
io.KeyShift = ((SDL_GetModState() & KMOD_SHIFT) != 0);
|
||||
io.KeyCtrl = ((SDL_GetModState() & KMOD_CTRL) != 0);
|
||||
io.KeyAlt = ((SDL_GetModState() & KMOD_ALT) != 0);
|
||||
return true;
|
||||
}
|
||||
{
|
||||
int key = event->key.keysym.sym & ~SDLK_SCANCODE_MASK;
|
||||
io.KeysDown[key] = (event->type == SDL_KEYDOWN);
|
||||
io.KeyShift = ((SDL_GetModState() & KMOD_SHIFT) != 0);
|
||||
io.KeyCtrl = ((SDL_GetModState() & KMOD_CTRL) != 0);
|
||||
io.KeyAlt = ((SDL_GetModState() & KMOD_ALT) != 0);
|
||||
io.KeySuper = ((SDL_GetModState() & KMOD_GUI) != 0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -143,6 +143,7 @@ bool ImGui_ImplSdl_ProcessEvent(SDL_Event* event)
|
||||
io.KeyShift = ((SDL_GetModState() & KMOD_SHIFT) != 0);
|
||||
io.KeyCtrl = ((SDL_GetModState() & KMOD_CTRL) != 0);
|
||||
io.KeyAlt = ((SDL_GetModState() & KMOD_ALT) != 0);
|
||||
io.KeySuper = ((SDL_GetModState() & KMOD_GUI) != 0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user