mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-18 06:06:35 +00:00
Minor comments + renaming internal fields
This commit is contained in:
parent
8971d70149
commit
790605e359
15
imgui.cpp
15
imgui.cpp
@ -2286,14 +2286,14 @@ void ImGui::NewFrame()
|
||||
mouse_earliest_button_down = i;
|
||||
}
|
||||
bool mouse_avail_to_imgui = (mouse_earliest_button_down == -1) || g.IO.MouseDownOwned[mouse_earliest_button_down];
|
||||
if (g.CaptureMouseNextFrame != -1)
|
||||
g.IO.WantCaptureMouse = (g.CaptureMouseNextFrame != 0);
|
||||
if (g.WantCaptureMouseNextFrame != -1)
|
||||
g.IO.WantCaptureMouse = (g.WantCaptureMouseNextFrame != 0);
|
||||
else
|
||||
g.IO.WantCaptureMouse = (mouse_avail_to_imgui && (g.HoveredWindow != NULL || mouse_any_down)) || (g.ActiveId != 0) || (!g.OpenPopupStack.empty());
|
||||
g.IO.WantCaptureKeyboard = (g.CaptureKeyboardNextFrame != -1) ? (g.CaptureKeyboardNextFrame != 0) : (g.ActiveId != 0);
|
||||
g.IO.WantCaptureKeyboard = (g.WantCaptureKeyboardNextFrame != -1) ? (g.WantCaptureKeyboardNextFrame != 0) : (g.ActiveId != 0);
|
||||
g.IO.WantTextInput = (g.ActiveId != 0 && g.InputTextState.Id == g.ActiveId);
|
||||
g.MouseCursor = ImGuiMouseCursor_Arrow;
|
||||
g.CaptureMouseNextFrame = g.CaptureKeyboardNextFrame = -1;
|
||||
g.WantCaptureMouseNextFrame = g.WantCaptureKeyboardNextFrame = -1;
|
||||
g.OsImePosRequest = ImVec2(1.0f, 1.0f); // OS Input Method Editor showing on top-left of our window by default
|
||||
|
||||
// If mouse was first clicked outside of ImGui bounds we also cancel out hovering.
|
||||
@ -3306,12 +3306,12 @@ void ImGui::SetMouseCursor(ImGuiMouseCursor cursor_type)
|
||||
|
||||
void ImGui::CaptureKeyboardFromApp(bool capture)
|
||||
{
|
||||
GImGui->CaptureKeyboardNextFrame = capture ? 1 : 0;
|
||||
GImGui->WantCaptureKeyboardNextFrame = capture ? 1 : 0;
|
||||
}
|
||||
|
||||
void ImGui::CaptureMouseFromApp(bool capture)
|
||||
{
|
||||
GImGui->CaptureMouseNextFrame = capture ? 1 : 0;
|
||||
GImGui->WantCaptureMouseNextFrame = capture ? 1 : 0;
|
||||
}
|
||||
|
||||
bool ImGui::IsItemHovered()
|
||||
@ -6478,6 +6478,7 @@ bool ImGui::InputScalarAsWidgetReplacement(const ImRect& aabb, const char* label
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
|
||||
// Our replacement widget will override the focus ID (registered previously to allow for a TAB focus to happen)
|
||||
// On the first frame, g.ScalarAsInputTextId == 0, then on subsequent frames it becomes == id
|
||||
SetActiveID(g.ScalarAsInputTextId, window);
|
||||
SetHoveredID(0);
|
||||
FocusableItemUnregister(window);
|
||||
@ -6723,7 +6724,6 @@ bool ImGui::SliderFloat(const char* label, float* v, float v_min, float v_max, c
|
||||
{
|
||||
SetActiveID(id, window);
|
||||
FocusWindow(window);
|
||||
|
||||
if (tab_focus_requested || g.IO.KeyCtrl)
|
||||
{
|
||||
start_text_input = true;
|
||||
@ -7024,7 +7024,6 @@ bool ImGui::DragFloat(const char* label, float* v, float v_speed, float v_min, f
|
||||
{
|
||||
SetActiveID(id, window);
|
||||
FocusWindow(window);
|
||||
|
||||
if (tab_focus_requested || g.IO.KeyCtrl || g.IO.MouseDoubleClicked[0])
|
||||
{
|
||||
start_text_input = true;
|
||||
|
@ -486,8 +486,8 @@ struct ImGuiContext
|
||||
float FramerateSecPerFrame[120]; // calculate estimate of framerate for user
|
||||
int FramerateSecPerFrameIdx;
|
||||
float FramerateSecPerFrameAccum;
|
||||
int CaptureMouseNextFrame; // explicit capture via CaptureInputs() sets those flags
|
||||
int CaptureKeyboardNextFrame;
|
||||
int WantCaptureMouseNextFrame; // explicit capture via CaptureInputs() sets those flags
|
||||
int WantCaptureKeyboardNextFrame;
|
||||
char TempBuffer[1024*3+1]; // temporary text buffer
|
||||
|
||||
ImGuiContext()
|
||||
@ -558,7 +558,7 @@ struct ImGuiContext
|
||||
memset(FramerateSecPerFrame, 0, sizeof(FramerateSecPerFrame));
|
||||
FramerateSecPerFrameIdx = 0;
|
||||
FramerateSecPerFrameAccum = 0.0f;
|
||||
CaptureMouseNextFrame = CaptureKeyboardNextFrame = -1;
|
||||
WantCaptureMouseNextFrame = WantCaptureKeyboardNextFrame = -1;
|
||||
memset(TempBuffer, 0, sizeof(TempBuffer));
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user