Osiris
Osiris copied to clipboard
menu elements clamping
it would be nice to add clamping to menu elements to prevent something like this:
(to do that hold ctrl before clicking on an element)
wtf? why dont u stop pressing ctrl before clicking on an element? i think it is a useless ask x.x kkk
Sometimes you can do it by accident. So im up for this also.
First version(not bad but not perfect)
sometimes it doesn't work
static LRESULT __stdcall hookedWndProc(HWND window, UINT msg, WPARAM wParam, LPARAM lParam) noexcept
{
if (msg == WM_KEYDOWN && LOWORD(wParam) == config.misc.menuKey) {
gui.isOpen = !gui.isOpen;
if (!gui.isOpen) {
ImGui::GetIO().MouseDown[0] = false;
interfaces.inputSystem->resetInputState();
}
}
if (gui.isOpen)
{
if ((msg == WM_LBUTTONDOWN || msg == WM_LBUTTONDBLCLK) && wParam & MK_CONTROL)
return CallWindowProc(hooks.originalWndProc, window, msg, wParam, lParam);
if (!ImGui_ImplWin32_WndProcHandler(window, msg, wParam, lParam))
{
return true;
}
}
return CallWindowProc(hooks.originalWndProc, window, msg, wParam, lParam);
}
Second version(perfect)
- Open imgui_widgets.cpp
- Find function https://github.com/danielkrupinski/Osiris/blob/084507d93206bf6129854b460aecf88acb7ab8b1/Osiris/imgui/imgui_widgets.cpp#L2391
- In this function delete this
if (start_text_input || (g.ActiveId == id && g.ScalarAsInputTextId == id))
{
window->DC.CursorPos = frame_bb.Min;
FocusableItemUnregister(window);
return InputScalarAsWidgetReplacement(frame_bb, id, label, data_type, v, format);
}