// (minor and older changes stripped away, please see git history for details)
// 2022-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
// 2022-09-01: Inputs: Honor GLFW_CURSOR_DISABLED by not setting mouse position.
// 2022-04-30: Inputs: Fixed ImGui_ImplGlfw_TranslateUntranslatedKey() for lower case letters on OSX.
// 2022-03-23: Inputs: Fixed a regression in 1.87 which resulted in keyboard modifiers events being reported incorrectly on Linux/X11.
// 2022-02-07: Added ImGui_ImplGlfw_InstallCallbacks()/ImGui_ImplGlfw_RestoreCallbacks() helpers to facilitate user installing callbacks after initializing backend.
// This gives a little bit of leeway before clearing the hover timer, allowing mouse to cross gaps
g.HoverDelayClearTimer+=g.IO.DeltaTime;
if(g.HoverDelayClearTimer>=ImMax(0.20f,g.IO.DeltaTime*2.0f))// ~6 frames at 30 Hz + allow for low framerate
g.HoverDelayTimer=g.HoverDelayClearTimer=0.0f;// May want a decaying timer, in which case need to clamp at max first, based on max of caller last requested timer.
if(!key_data->Down)// In theory this should already be encoded as (DownDuration < 0.0f), but testing this facilitate eating mechanism (until we finish work on input ownership)
if(!key_data->Down)// In theory this should already be encoded as (DownDuration < 0.0f), but testing this facilitate eating mechanism (until we finish work on input ownership)
if(!g.IO.MouseDown[button])// In theory this should already be encoded as (DownDuration < 0.0f), but testing this facilitate eating mechanism (until we finish work on input ownership)
Text("HoveredId: 0x%08X (%.2f sec), AllowOverlap: %d",g.HoveredIdPreviousFrame,g.HoveredIdTimer,g.HoveredIdAllowOverlap);// Not displaying g.HoveredId as it is update mid-frame
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
ImGuiHoveredFlags_DelayNormal=1<<11,// Return true after io.HoverDelayNormal elapsed (~0.30 sec)
ImGuiHoveredFlags_DelayShort=1<<12,// Return true after io.HoverDelayShort elapsed (~0.10 sec)
ImGuiHoveredFlags_NoSharedDelay=1<<13,// Disable shared delay system where moving from one item to the next keeps the previous timer for a short time (standard for tooltips with long delays)
};
// Flags for ImGui::DockSpace(), shared/inherited by child nodes.
@ -1789,7 +1794,7 @@ enum ImGuiMouseCursor_
enumImGuiCond_
{
ImGuiCond_None=0,// No condition (always set the variable), same as _Always
ImGuiCond_Always=1<<0,// No condition (always set the variable)
ImGuiCond_Always=1<<0,// No condition (always set the variable), same as _None
ImGuiCond_Once=1<<1,// Set the variable once per runtime session (only the first call will succeed)
ImGuiCond_FirstUseEver=1<<2,// Set the variable if the object/window has no persistently saved data (no entry in .ini file)
ImGuiCond_Appearing=1<<3,// Set the variable if the object/window is appearing after being hidden/inactive (or the first time)
// NB: For basic min/max size constraint on each axis you don't need to use the callback! The SetNextWindowSizeConstraints() parameters are enough.
structImGuiSizeCallbackData
{
void*UserData;// Read-only. What user passed to SetNextWindowSizeConstraints()
void*UserData;// Read-only. What user passed to SetNextWindowSizeConstraints(). Generally store an integer or float in here (need reinterpret_cast<>).
ImVec2Pos;// Read-only. Window position, for reference.
ImVec2CurrentSize;// Read-only. Current window size.
ImVec2DesiredSize;// Read-write. Desired size, based on user's mouse position. Write to this field to restrain resizing.
@ -3254,6 +3261,18 @@ namespace ImGui
//static inline bool IsRootWindowOrAnyChildFocused() { return IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows); } // OBSOLETED in 1.53 (between Oct 2017 and Dec 2017)
//static inline void SetNextWindowContentWidth(float w) { SetNextWindowContentSize(ImVec2(w, 0.0f)); } // OBSOLETED in 1.53 (between Oct 2017 and Dec 2017)
//static inline float GetItemsLineHeightWithSpacing() { return GetFrameHeightWithSpacing(); } // OBSOLETED in 1.53 (between Oct 2017 and Dec 2017)
//IMGUI_API bool Begin(char* name, bool* p_open, ImVec2 size_first_use, float bg_alpha = -1.0f, ImGuiWindowFlags flags=0); // OBSOLETED in 1.52 (between Aug 2017 and Oct 2017): Equivalent of using SetNextWindowSize(size, ImGuiCond_FirstUseEver) and SetNextWindowBgAlpha().
//static inline bool IsRootWindowOrAnyChildHovered() { return IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows); } // OBSOLETED in 1.52 (between Aug 2017 and Oct 2017)
//static inline void AlignFirstTextHeightToWidgets() { AlignTextToFramePadding(); } // OBSOLETED in 1.52 (between Aug 2017 and Oct 2017)
//static inline void SetNextWindowPosCenter(ImGuiCond c=0) { SetNextWindowPos(GetMainViewport()->GetCenter(), c, ImVec2(0.5f,0.5f)); } // OBSOLETED in 1.52 (between Aug 2017 and Oct 2017)
//static inline bool IsItemHoveredRect() { return IsItemHovered(ImGuiHoveredFlags_RectOnly); } // OBSOLETED in 1.51 (between Jun 2017 and Aug 2017)
//static inline bool IsPosHoveringAnyWindow(const ImVec2&) { IM_ASSERT(0); return false; } // OBSOLETED in 1.51 (between Jun 2017 and Aug 2017): This was misleading and partly broken. You probably want to use the io.WantCaptureMouse flag instead.
//static inline bool IsMouseHoveringAnyWindow() { return IsWindowHovered(ImGuiHoveredFlags_AnyWindow); } // OBSOLETED in 1.51 (between Jun 2017 and Aug 2017)
//static inline bool IsMouseHoveringWindow() { return IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem); } // OBSOLETED in 1.51 (between Jun 2017 and Aug 2017)
"Using the simplified one-liner ListBox API here.\nRefer to the \"List boxes\" section below for an explanation of how to use the more flexible and general BeginListBox/EndListBox API.");
if(type==2)ImGui::SetNextWindowSizeConstraints(ImVec2(-1,0),ImVec2(-1,FLT_MAX));// Vertical only
if(type==3)ImGui::SetNextWindowSizeConstraints(ImVec2(0,-1),ImVec2(FLT_MAX,-1));// Horizontal only
if(type==4)ImGui::SetNextWindowSizeConstraints(ImVec2(400,-1),ImVec2(500,-1));// Width Between and 400 and 500
if(type==5)ImGui::SetNextWindowSizeConstraints(ImVec2(0,0),ImVec2(FLT_MAX,FLT_MAX),CustomConstraints::AspectRatio,(void*)&aspect_ratio);// Aspect ratio
ImGuiWindow*Window;// Resolved on BeginPopup() - may stay unresolved if user never calls OpenPopup()
ImGuiWindow*SourceWindow;// Set on OpenPopup() copy of NavWindow at the time of opening the popup
ImGuiWindow*BackupNavWindow;// Set on OpenPopup(), a NavWindow that will be restored on popup close
intParentNavLayer;// Resolved on BeginPopup(). Actually a ImGuiNavLayer type (declared down below), initialized to -1 which is not part of an enum, but serves well-enough as "not any of layers" value
intOpenFrameCount;// Set on OpenPopup()
ImGuiIDOpenParentId;// Set on OpenPopup(), we need this to differentiate multiple menu sets from each others (e.g. inside menu bar vs loose menu items)
@ -1971,6 +1971,12 @@ struct ImGuiContext
ImVector<ImGuiPtrOrIndex>CurrentTabBarStack;
ImVector<ImGuiShrinkWidthItem>ShrinkWidthBuffer;
// Hover Delay system
ImGuiIDHoverDelayId;
ImGuiIDHoverDelayIdPreviousFrame;
floatHoverDelayTimer;// Currently used IsItemHovered(), generally inferred from g.HoveredIdTimer but kept uncleared until clear timer elapse.
floatHoverDelayClearTimer;// Currently used IsItemHovered(): grace time before g.TooltipHoverTimer gets cleared.
// Widget state
ImVec2MouseLastValidPos;
ImGuiInputTextStateInputTextState;
@ -1992,7 +1998,6 @@ struct ImGuiContext
floatDisabledAlphaBackup;// Backup for style.Alpha for BeginDisabled()
shortDisabledStackSize;
shortTooltipOverrideCount;
floatTooltipSlowDelay;// Time before slow tooltips appears (FIXME: This is temporary until we merge in tooltip timer+priority work)
ImVector<char>ClipboardHandlerData;// If no custom clipboard handler is defined
ImVector<ImGuiID>MenusIdSubmittedThisFrame;// A list of menu IDs that were rendered at least once
// The 'HovereWindow == window' check creates an inconsistency (e.g. moving away from menu slowly tends to hit same window, whereas moving away fast does not)
// But we also need to not close the top-menu menu when moving over void. Perhaps we should extend the triangle check to a larger polygon.
// (Remember to test this on BeginPopup("A")->BeginMenu("B") sequence which behaves slightly differently as B isn't a Child of A and hovering isn't shared.)