From d2e6d41619fb7421e446a678b1ac184ce76235d3 Mon Sep 17 00:00:00 2001 From: Malik Olivier Boussejra Date: Sun, 29 Apr 2018 23:29:37 +0900 Subject: [PATCH] [cimgui 1.53.1] Obsolete igSetNextWindowContentWidth There is a small change of behaviour: previous height value is not preserved when igSetNextWindowContentWidth is used. There is no way around it unless we mess with imgui's internals. Official Dear ImGui chose this easy solution as well: static inline void SetNextWindowContentWidth(float w) { SetNextWindowContentSize(ImVec2(w, 0.0f)); } https://github.com/ocornut/imgui/blob/429f48bb4fa7fdffdb996e4a697d6df48babe3eb/imgui.h#L1132 --- CHANGELOG.markdown | 2 ++ imgui-sys/src/lib.rs | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.markdown b/CHANGELOG.markdown index 9456cf1..5eedb94 100644 --- a/CHANGELOG.markdown +++ b/CHANGELOG.markdown @@ -12,6 +12,8 @@ `sys::igIsWindowFocused(ImGuiFocusedFlags::RootAndChildWindows)`. - Obsolete `sys::igIsRootWindowOrAnyChildHovered()` in favor of using `sys::igIsWindowHovered(ImGuiHoveredFlags::RootAndChildWindows)`. + - Obsolete `sys::SetNextWindowContentWidth()` in favor of using + `sys::igSetNextWindowContentSize()`. ## [0.0.18] - 2017-12-23 diff --git a/imgui-sys/src/lib.rs b/imgui-sys/src/lib.rs index 030dc01..0997d2f 100644 --- a/imgui-sys/src/lib.rs +++ b/imgui-sys/src/lib.rs @@ -930,7 +930,6 @@ extern "C" { custom_callback_data: *mut c_void, ); pub fn igSetNextWindowContentSize(size: ImVec2); - pub fn igSetNextWindowContentWidth(width: c_float); pub fn igSetNextWindowCollapsed(collapsed: bool, cond: ImGuiCond); pub fn igSetNextWindowFocus(); pub fn igSetWindowPos(pos: ImVec2, cond: ImGuiCond); @@ -963,6 +962,15 @@ pub unsafe fn igSetNextWindowPosCenter(cond: ImGuiCond) { let pivot = ImVec2::new(0.5, 0.5); igSetNextWindowPos(pos, cond, pivot); } +/// Set next window content's width. +/// +/// Original non-deprecated version preserved last Y value set by +/// [`igSetNextWindowContentSize`]. +#[allow(non_snake_case)] +#[deprecated(since = "0.0.19", note = "please use igSetNextWindowContentSize instead")] +pub unsafe fn igSetNextWindowContentWidth(width: c_float) { + igSetNextWindowContentSize(ImVec2 { x: width, y: 0.0 }) +} // Parameter stack (shared) extern "C" {