mirror of
https://github.com/ocornut/imgui.git
synced 2025-01-30 19:43:51 +01:00
Added io.KeyAlt + support in examples apps
Currently unused but supported by sample so that more people will have it set up when menus needs them
This commit is contained in:
parent
58dc3f97c5
commit
0911526424
@ -455,6 +455,7 @@ void ImGui_ImplDX11_NewFrame()
|
|||||||
// Read keyboard modifiers inputs
|
// Read keyboard modifiers inputs
|
||||||
io.KeyCtrl = (GetKeyState(VK_CONTROL) & 0x8000) != 0;
|
io.KeyCtrl = (GetKeyState(VK_CONTROL) & 0x8000) != 0;
|
||||||
io.KeyShift = (GetKeyState(VK_SHIFT) & 0x8000) != 0;
|
io.KeyShift = (GetKeyState(VK_SHIFT) & 0x8000) != 0;
|
||||||
|
io.KeyAlt = (GetKeyState(VK_MENU) & 0x8000) != 0;
|
||||||
// io.KeysDown : filled by WM_KEYDOWN/WM_KEYUP events
|
// io.KeysDown : filled by WM_KEYDOWN/WM_KEYUP events
|
||||||
// io.MousePos : filled by WM_MOUSEMOVE events
|
// io.MousePos : filled by WM_MOUSEMOVE events
|
||||||
// io.MouseDown : filled by WM_*BUTTON* events
|
// io.MouseDown : filled by WM_*BUTTON* events
|
||||||
|
@ -117,6 +117,10 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||||||
ImGui_ImplDX11_CreateDeviceObjects();
|
ImGui_ImplDX11_CreateDeviceObjects();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
case WM_SYSCOMMAND:
|
||||||
|
if ((wParam & 0xfff0) == SC_KEYMENU) // Disable ALT application menu
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -276,6 +276,7 @@ void ImGui_ImplDX9_NewFrame()
|
|||||||
// Read keyboard modifiers inputs
|
// Read keyboard modifiers inputs
|
||||||
io.KeyCtrl = (GetKeyState(VK_CONTROL) & 0x8000) != 0;
|
io.KeyCtrl = (GetKeyState(VK_CONTROL) & 0x8000) != 0;
|
||||||
io.KeyShift = (GetKeyState(VK_SHIFT) & 0x8000) != 0;
|
io.KeyShift = (GetKeyState(VK_SHIFT) & 0x8000) != 0;
|
||||||
|
io.KeyAlt = (GetKeyState(VK_MENU) & 0x8000) != 0;
|
||||||
// io.KeysDown : filled by WM_KEYDOWN/WM_KEYUP events
|
// io.KeysDown : filled by WM_KEYDOWN/WM_KEYUP events
|
||||||
// io.MousePos : filled by WM_MOUSEMOVE events
|
// io.MousePos : filled by WM_MOUSEMOVE events
|
||||||
// io.MouseDown : filled by WM_*BUTTON* events
|
// io.MouseDown : filled by WM_*BUTTON* events
|
||||||
|
@ -30,6 +30,10 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||||||
ImGui_ImplDX9_CreateDeviceObjects();
|
ImGui_ImplDX9_CreateDeviceObjects();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
case WM_SYSCOMMAND:
|
||||||
|
if ((wParam & 0xfff0) == SC_KEYMENU) // Disable ALT application menu
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -143,6 +143,7 @@ void ImGui_ImplGlfwGL3_KeyCallback(GLFWwindow* window, int key, int scancode, in
|
|||||||
io.KeysDown[key] = false;
|
io.KeysDown[key] = false;
|
||||||
io.KeyCtrl = (mods & GLFW_MOD_CONTROL) != 0;
|
io.KeyCtrl = (mods & GLFW_MOD_CONTROL) != 0;
|
||||||
io.KeyShift = (mods & GLFW_MOD_SHIFT) != 0;
|
io.KeyShift = (mods & GLFW_MOD_SHIFT) != 0;
|
||||||
|
io.KeyAlt = (mods & GLFW_MOD_ALT) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui_ImplGlfwGL3_CharCallback(GLFWwindow* window, unsigned int c)
|
void ImGui_ImplGlfwGL3_CharCallback(GLFWwindow* window, unsigned int c)
|
||||||
|
@ -123,6 +123,7 @@ void ImGui_ImplGlFw_KeyCallback(GLFWwindow* window, int key, int scancode, int a
|
|||||||
io.KeysDown[key] = false;
|
io.KeysDown[key] = false;
|
||||||
io.KeyCtrl = (mods & GLFW_MOD_CONTROL) != 0;
|
io.KeyCtrl = (mods & GLFW_MOD_CONTROL) != 0;
|
||||||
io.KeyShift = (mods & GLFW_MOD_SHIFT) != 0;
|
io.KeyShift = (mods & GLFW_MOD_SHIFT) != 0;
|
||||||
|
io.KeyAlt = (mods & GLFW_MOD_ALT) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui_ImplGlfw_CharCallback(GLFWwindow* window, unsigned int c)
|
void ImGui_ImplGlfw_CharCallback(GLFWwindow* window, unsigned int c)
|
||||||
|
@ -314,6 +314,7 @@
|
|||||||
- input: support track pad style scrolling & slider edit.
|
- input: support track pad style scrolling & slider edit.
|
||||||
- tooltip: move to fit within screen (e.g. when mouse cursor is right of the screen).
|
- tooltip: move to fit within screen (e.g. when mouse cursor is right of the screen).
|
||||||
- portability: big-endian test/support (github issue #81)
|
- portability: big-endian test/support (github issue #81)
|
||||||
|
- misc: let user copy any window content to clipboard easily (CTRL+C on windows? while moving it? context menu?)
|
||||||
- misc: mark printf compiler attributes on relevant functions
|
- misc: mark printf compiler attributes on relevant functions
|
||||||
- misc: provide a way to compile out the entire implementation while providing a dummy API (e.g. #define IMGUI_DUMMY_IMPL)
|
- misc: provide a way to compile out the entire implementation while providing a dummy API (e.g. #define IMGUI_DUMMY_IMPL)
|
||||||
- misc: double-clicking on title bar to minimize isn't consistent, perhaps move to single-click on left-most collapse icon?
|
- misc: double-clicking on title bar to minimize isn't consistent, perhaps move to single-click on left-most collapse icon?
|
||||||
@ -4014,7 +4015,7 @@ static bool ButtonBehaviour(const ImGuiAabb& bb, const ImGuiID& id, bool* out_ho
|
|||||||
if (hovered)
|
if (hovered)
|
||||||
{
|
{
|
||||||
g.HoveredId = id;
|
g.HoveredId = id;
|
||||||
if (allow_key_modifiers || (!g.IO.KeyCtrl && !g.IO.KeyShift))
|
if (allow_key_modifiers || (!g.IO.KeyCtrl && !g.IO.KeyShift && !g.IO.KeyAlt))
|
||||||
{
|
{
|
||||||
if (g.IO.MouseClicked[0])
|
if (g.IO.MouseClicked[0])
|
||||||
{
|
{
|
||||||
@ -8582,6 +8583,7 @@ void ImGui::ShowTestWindow(bool* opened)
|
|||||||
ImGui::Text("ImGui says hello.");
|
ImGui::Text("ImGui says hello.");
|
||||||
//ImGui::Text("MousePos (%g, %g)", ImGui::GetIO().MousePos.x, ImGui::GetIO().MousePos.y);
|
//ImGui::Text("MousePos (%g, %g)", ImGui::GetIO().MousePos.x, ImGui::GetIO().MousePos.y);
|
||||||
//ImGui::Text("MouseWheel %d", ImGui::GetIO().MouseWheel);
|
//ImGui::Text("MouseWheel %d", ImGui::GetIO().MouseWheel);
|
||||||
|
ImGui::Text("KeyMods %s%s%s", ImGui::GetIO().KeyCtrl ? "CTRL" : "", ImGui::GetIO().KeyShift ? "SHIFT" : "", ImGui::GetIO().KeyAlt? "ALT" : "");
|
||||||
//ImGui::Text("WantCaptureMouse: %d", ImGui::GetIO().WantCaptureMouse);
|
//ImGui::Text("WantCaptureMouse: %d", ImGui::GetIO().WantCaptureMouse);
|
||||||
//ImGui::Text("WantCaptureKeyboard: %d", ImGui::GetIO().WantCaptureKeyboard);
|
//ImGui::Text("WantCaptureKeyboard: %d", ImGui::GetIO().WantCaptureKeyboard);
|
||||||
|
|
||||||
|
1
imgui.h
1
imgui.h
@ -601,6 +601,7 @@ struct ImGuiIO
|
|||||||
bool MouseDrawCursor; // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor).
|
bool MouseDrawCursor; // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor).
|
||||||
bool KeyCtrl; // Keyboard modifier pressed: Control
|
bool KeyCtrl; // Keyboard modifier pressed: Control
|
||||||
bool KeyShift; // Keyboard modifier pressed: Shift
|
bool KeyShift; // Keyboard modifier pressed: Shift
|
||||||
|
bool KeyAlt; // Keyboard modifier pressed: Alt
|
||||||
bool KeysDown[512]; // Keyboard keys that are pressed (in whatever storage order you naturally have access to keyboard data)
|
bool KeysDown[512]; // Keyboard keys that are pressed (in whatever storage order you naturally have access to keyboard data)
|
||||||
ImWchar InputCharacters[16+1]; // List of characters input (translated by user from keypress+keyboard state). Fill using AddInputCharacter() helper.
|
ImWchar InputCharacters[16+1]; // List of characters input (translated by user from keypress+keyboard state). Fill using AddInputCharacter() helper.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user